天天看點

Docker入門一安裝

Install Docker on Ubuntu Linux

$ curl -fsSL https://get.docker.com/ | sh
           
安裝成功後
docker version

sudo service docker start

sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-docker.io/v2/library/hello-world/manifests/latest: Get https://auth.docker.io/token?scope=repository%Alibrary%Fhello-world%Apull&service=registry.docker.io: read tcp :->:: read: connection reset by peer.

不能從國外下載下傳鏡像檔案 參考下面連結配置國内鏡像庫
           

配置國内免費registry mirror

在 https://www.daocloud.io 新增賬號 使用Docker 加速器

修改docker檔案
sudo vi /etc/default/docker

DOCKER_OPTS="--registry-mirror=http://yourRegist.m.daocloud.io"
最後
service docker restart
           
sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
dd45222: Pull complete 
Digest: sha256:f4620e6cf3e795643fac2f6b09e7fd0a29e7e5c4eee6aac9ba0bedca158c
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
           
~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
f6935ce73938        hello-world         "/hello"             seconds ago      Exited ()  seconds ago                    
           

繼續閱讀