1.常用命令和操作

(1)参考:https://shimo.im/docs/FnT8B0CdmlkiD1mO/read

(2)补充

进入容器是exec,退出容器用exit

2.镜像下载慢,加速

(1)方法一

docker pull daocloud.io/library/mysql

参考:https://blog.csdn.net/bb74747/article/details/82534993

(2)方法二:靠谱镜像源

①docker国内源 :

  - 【推荐】中国区官方 : https://registry.docker-cn.com

  - 【推荐】网易云镜像 : http://hub-mirror.c.163.com

  - ustc源 : https://docker.mirrors.ustc.edu.cn

  - 阿里云镜像

  - Dao镜像 : http://f1361db2.m.daocloud.io

②说明

daocloud.io/library:下载mysql很快,下载ubuntu就很慢了

阿里云:下载ubuntu很快

阿里云镜像库配置:https://www.jianshu.com/p/1a4025c5f186

(3)方法三:另一种修改源方法(推荐)

先安装curl:

sudo apt-get update; sudo apt-get install curl

修改源:

$ curl -sSL https://raw.githubusercontent.com/wss434631143/xiaoshujiang/master/articles/Docker/shell/set_mirror.sh | sh -s https://registry.docker-cn.com

重启docker服务:

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

 

3.获取管理权限

(1)报错:

docker pull registry.docker-cn.com/library/mysql
Using default tag: latest
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/create?fromImage=registry.docker-cn.com%2Flibrary%2Fmysql&tag=latest: dial unix /var/run/docker.sock: connect: permission denied

(2)因为需要获取权限

sudo groupadd docker #添加docker用户组

sudo gpasswd -a $USER docker #将登陆用户加入到docker用户组中

newgrp docker #更新用户组

参考:https://blog.csdn.net/icodestechnology/article/details/97170540

4. docker状态转换

参考:

https://blog.csdn.net/K_Actor/article/details/100513890?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

 

posted on 2020-05-24 03:21  西伯尔  阅读(391)  评论(0编辑  收藏  举报