如何把容器镜像内文件拷贝出来
作者:互联网
例子拷贝nginx
容器镜像默认配置到容器外
话不多说,直接上脚本代码
#!/bin/bash
set -eux
__CURRENT__=`pwd`
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}
container_id=$(docker create nginx:alpine) # returns container ID
docker cp $container_id:/etc/nginx/nginx.conf nginx.conf
docker cp $container_id:/etc/nginx/mime.types mime.types
docker cp $container_id:/etc/nginx/conf.d/default.conf default.conf
docker rm $container_id
标签:__,容器,container,nginx,docker,conf,镜像,拷贝,id 来源: https://www.cnblogs.com/jingjingxyk/p/16575555.html