0%

centos7安装docker

看Linux内核版本,Docker 要求 CentOS 系统的内核版本高于 3.10
uname -r
yum -y install docker-io
systemctl restart docker
运行hello-world
docker run hello-world

docker常用命令

版本
docker version
查看镜像
docker images
拉取镜像
docker pull
创建镜像 
docker build
运行镜像
docker run hello-world
查看进程
docker ps
docker ps -a
拷贝
docker cp index.html 17addaweri58c://usr/share/nginx/html
启动nginx
docker run -p 8080:80 -d daocloud.io/nginx
停止
docker stop 17addaweri58c
保存更改
docker commit -m 'fun'
docker commit -m 'fun' easfieir nginx-fun
删除
docker rmi asdfieirwiwqri
docker rm asfdiewiirrwei
搜索镜像
docker search --filter=stars=3 lnmp

配置加速器


[root@localhost ~]# vi /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://e2dszuyu.mirror.aliyuncs.com"]
}
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker
[root@localhost ~]#