[root@node1 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/ubuntu latest b44d403a0d52 3 days ago 64.2 MB docker.io/nginx latest 540a289bab6c 12 days ago 126 MB docker.io/hello-world latest fce289e99eb9 10 months ago 1.84 kB [root@node1 ~]# [root@node1 ~]# docker run -it docker.io/ubuntu /bin/bash root@b44d403a0d52:/#
更新apt缓存:
更换更新源: vi /etc/apt/sources.list
1 2 3 4 5 6 7 8 9 10 11
#aliyun deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
root@b44d403a0d52:/# mkdir /root/.ssh root@b44d403a0d52:/# cd /root/.ssh root@b44d403a0d52::~/.ssh# ls root@b44d403a0d52:~/.ssh# vi /root/.ssh/authorized_keys
[root@node1 ~]# ssh 172.17.0.3 The authenticity of host '172.17.0.3 (172.17.0.3)' can't be established. ECDSA key fingerprint is SHA256:E52UcTYNRUigoz7AjFcNNZxtxMAxfuXb2Oqn71wZIXA. ECDSA key fingerprint is MD5:6f:4f:32:90:c8:59:6b:cb:b3:fa:92:32:71:46:eb:e3. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '172.17.0.3' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 14.04 LTS (GNU/Linux 4.4.0-146-generic x86_64)
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
root@2f3d3f69a26c:~# root@2f3d3f69a26c:~#
使用Dockerfile创建
创建工作目录
1 2 3 4 5 6
[root@node1 ~]# mkdir ubuntu [root@node1 ~]# cd ubuntu [root@node1 ubuntu]# touch Dockerfile run.sh [root@node1 ubuntu]# ls Dockerfile run.sh [root@node1 ubuntu]#
[root@node1 ~]# ssh 172.17.0.2 The authenticity of host '172.17.0.2 (172.17.0.2)' can't be established. ECDSA key fingerprint is SHA256:E52UcTYNRUigoz7AjFcNNZxtxMAxfuXb2Oqn71wZIXA. ECDSA key fingerprint is MD5:6f:4f:32:90:c8:59:6b:cb:b3:fa:92:32:71:46:eb:e3. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '172.17.0.2' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 14.04 LTS (GNU/Linux 4.4.0-146-generic x86_64)
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.