Docker cp 複製問題

  1. CentOS 6 支援的 docker 最高版本是 1.7.1,docker version 查看版本。
    [root@dyw219 bin]# docker version
    Client version: 1.7.1
    Client API version: 1.19
    Go version (client): go1.4.2
    Git commit (client): 786b29d
    OS/Arch (client): linux/amd64
    Server version: 1.7.1
    Server API version: 1.19
    Go version (server): go1.4.2
    Git commit (server): 786b29d
    OS/Arch (server): linux/amd64
    
  2. 使用 centos/httpd:index image 建立名為 myweb 的容器,讓 host 80 port 連到容器的 httpd 8080 port。
    [root@dyw219 newimg]# docker run -dit --name myweb -p 8080:80 centos/httpd:index
    6f9d0405f15bb13e7723b637e90eb18a7a7306289ce659ec8f88f7fcd6cd5b78
    
  3. 連線 centos/httpd:index 容器,網頁內容是新增的 "myweb test"。
    [root@dyw219 newimg]# curl http://127.0.0.1:8080
    myweb test
    
  4. docker ps 查看容器 ID 是 6f9d0405f15b。
    CONTAINER ID IMAGE              COMMAND         CREATED      STATUS      PORTS                NAMES
    6f9d0405f15b centos/httpd:index "/run-httpd.sh" 10 hours ago Up 10 hours 0.0.0.0:8080->80/tcp myweb
    
  5. docker cp 複製 host 的 index.html 到容器 6f9d0405f15b 的 /var/www/html/ 目錄,出現錯誤。
    [root@dyw219 newimg]# docker cp index.html 6f9d0405f15b:/var/www/html/
    Error: Path not specified
    
  6. CentOS 6 Docker 打包套件只到 1.7.1 版,但 docker 1.7.1 不支援 cp 複製。