Tag: docker exec

  • docker–拷贝宿主机文件到容器的两种方法

    第一种方法适用于1.8版本以后的docker,参见文章: docker cp容器和宿主机的文件复制拷贝 第二种方法是完全利用 docker exec 命令: [root@iZj6c4kga39y2z70xmt5y9Z ~]# echo ‘i am in the host’ > one.txt [root@iZj6c4kga39y2z70xmt5y9Z ~]# docker exec -i new1 sh -c ‘cat > /cookbook/one.txt’ < one.txt  [root@iZj6c4kga39y2z70xmt5y9Z ~]# docker exec -i new1 sh -c ‘cat /cookbook/one.txt’ i am in the host