Ubuntu上:
>>> docker export c57784 > ~/ubuntu_base_0603.tar
export 导出的是容器,不包含历史commit记录,而不是镜像,导出镜像命令是save,导入为load
windows上:
>>> scp root@ip:~/ubuntu_base_0603.tar .
>>> docker import ubuntu_base_0603.tar
用git bash启动镜像时会报错:
>>> docker run -itd ubuntu:base /bin/bash
692e9b356b78f508bdc077c3df8e6dbb4af0f1e61c238f9a9a184f968a74749c
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"C:/Program Files/Git/usr/bin/bash\": stat C:/Program Files/Git/usr/bin/bash: no such file or directory": unknown.
而用cmd则没有问题
这是由于git bash在解析’/bin/bash‘时使用了某种机制,而这种机制在这里比较多余,使用双斜杠’//‘可以禁用这种机制,具体可以参考
因而解决方案就是:
>>> docker run -itd ubuntu:base //bin/sh
>>> winpty docker exec -it cb36 //bin/zsh