Docker学习笔记:故障排除

坑一

st@Docker:~$ docker search centos
Warning: failed to get default registry endpoint from daemon (Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/info: dial unix /var/run/docker.sock: connect: permission denied). Using system default: https://index.docker.io/v1/
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/images/search?limit=25&term=centos: dial unix /var/run/docker.sock: connect: permission denied

st@Docker:~$ sudo groupadd docker
groupadd: group 'docker' already exists
st@Docker:~$ sudo service docker restart
st@Docker:~$ sudo gpasswd -a ${USER} docker
Adding user student to group docker
st@Docker:~$ sudo service docker restart

###需重新端口终端再次连接。

坑二

st@Docker:~$ docker search centos
WARNING: Error loading config file: /home/st/.docker/config.json - stat /home/st/.docker/config.json: permission denied
            
st@Docker:~$ sudo ls -l /home/st/.docker/config.json
-rw------- 1 st st 164  3月 10 10:54 /home/st/.docker/config.json
st@Docker:~$ sudo chown root:root /home/st/.docker/config.json
st@Docker:~$ sudo chown $USER:docker ~/.docker
st@Docker:~$ sudo chown $USER:docker ~/.docker/config.json
st@Docker:~$ sudo chmod g+rw ~/.docker/config.json
st@Docker:~$ sudo ls -ld .docker
drwx------ 2 st docker 4096  3月 10 10:54 .docker
st@Docker:~$ sudo ls -ld .docker/*
-rw-rw---- 1 st docker 164  3月 10 10:54 .docker/config.json

坑三

##docker push镜像到docker hub 上,需要使用用户名登录,不能使用注册邮箱登录。
st@Docker:~$ docker login
Username: [email protected]
Password: 
Error response from daemon: login attempt to https://hub.docker.com/v2/ failed with status: 404 Not Found
st@Docker:~$ docker login 
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: yxr877431436    
Password: Yxr19890620.
Login Succeeded
st@Docker:~$ docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
yxr877431436/web02    latest              eafb9ba67a55        10 minutes ago      209MB
fedora                latest              9110ae7f579f        5 days ago          235MB
ubuntu                latest              f975c5035748        6 days ago          112MB
ubuntu                14.04               a35e70164dfb        6 days ago          222MB
centos                latest              2d194b392dd1        7 days ago          195MB
ubuntu                12.10               3e314f95dcac        3 years ago         172MB
yxr877431436/ubuntu   12.10               3e314f95dcac        3 years ago         172MB
st@Docker:~$ docker push yxr877431436/ubuntu:12.10
The push refers to repository [docker.io/yxr877431436/ubuntu]
9c1baa8bba5a: Pushed 
0f638919270d: Mounted from library/ubuntu 
54c9e1d9aefd: Pushed 
7eb156de262c: Pushed 
5f70bf18a086: Mounted from library/ubuntu 
12.10: digest: sha256:8951abed67b9ffbb0a936b8ebb6bad6623039f4caa154a232fe10e04ebdcd9c3 size: 1363
st@Docker:~$ docker push yxr877431436/web02
The push refers to repository [docker.io/yxr877431436/web02]
d8b396109b77: Pushed 
db584c622b50: Pushed 
52a7ea2bb533: Pushed 
52f389ea437e: Pushed 
88888b9b1b5b: Pushed 
a94e0d5a7c40: Pushed 
latest: digest: sha256:ba3757c7bc8ff36c386949c1fd242c555bc969acf755b7a67e2db235ecdb7cd2 size: 1569

坑四

st@Docker:~$ docker images
REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
ubuntu_nginx_server                latest              eafb9ba67a55        26 minutes ago      209MB
yxr877431436/ubuntu_nginx_server   latest              eafb9ba67a55        26 minutes ago      209MB
yxr877431436/web02                 latest              eafb9ba67a55        26 minutes ago      209MB
fedora                             latest              9110ae7f579f        5 days ago          235MB
ubuntu                             latest              f975c5035748        6 days ago          112MB
ubuntu                             14.04               a35e70164dfb        6 days ago          222MB
centos                             latest              2d194b392dd1        7 days ago          195MB
ubuntu                             12.10               3e314f95dcac        3 years ago         172MB
yxr877431436/ubuntu                12.10               3e314f95dcac        3 years ago         172MB
st@Docker:~$ docker push ubuntu_nginx_server 
The push refers to repository [docker.io/library/ubuntu_nginx_server]
d8b396109b77: Preparing 
db584c622b50: Preparing 
52a7ea2bb533: Preparing 
52f389ea437e: Preparing 
88888b9b1b5b: Preparing 
a94e0d5a7c40: Waiting 
denied: requested access to the resource is denied
st@Docker:~$ docker tag ubuntu_nginx_server yxr877431436/ubuntu_nginx_server 
st@Docker:~$ docker images
REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
ubuntu_nginx_server                latest              eafb9ba67a55        26 minutes ago      209MB
yxr877431436/ubuntu_nginx_server   latest              eafb9ba67a55        26 minutes ago      209MB
yxr877431436/web02                 latest              eafb9ba67a55        26 minutes ago      209MB
fedora                             latest              9110ae7f579f        5 days ago          235MB
ubuntu                             latest              f975c5035748        6 days ago          112MB
ubuntu                             14.04               a35e70164dfb        6 days ago          222MB
centos                             latest              2d194b392dd1        7 days ago          195MB
ubuntu                             12.10               3e314f95dcac        3 years ago         172MB
yxr877431436/ubuntu                12.10               3e314f95dcac        3 years ago         172MB
st@Docker:~$ docker push yxr877431436/ubuntu_nginx_server
The push refers to repository [docker.io/yxr877431436/ubuntu_nginx_server]
d8b396109b77: Pushed 
db584c622b50: Pushed 
52a7ea2bb533: Pushed 
52f389ea437e: Pushed 
88888b9b1b5b: Pushed 
a94e0d5a7c40: Pushed 
latest: digest: sha256:ba3757c7bc8ff36c386949c1fd242c555bc969acf755b7a67e2db235ecdb7cd2 size: 1569

坑五

你可能感兴趣的:(Container)