1 参考文档
https://docs.docker.com/install/linux/docker-ce/centos/
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
2 docker安装
$ wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm $ sudo yum install docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm # 加入自启动 $ sudo systemctl enable docker # 启动docker $ sudo systemctl start docker $ sudo docker run hello-world
3 开启远程访问
$ sudo systemctl status docker # 开远程端口,允许远程访问 $ sudo vi /usr/lib/systemd/system/docker.service ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock # 刷新配置 $ sudo systemctl daemon-reload # 重启docker $ sudo systemctl restart docker
测试
$ curl http://localhost:2375/version $ curl http://localhost:2375/info
4 常用命令
# 列出本地镜像 $ sudo docker images # 删除本地一个或多少镜像 $ sudo docker rmi -f rancher/server # 列出容器 $ sudo docker ps # 显示所有的容器,包括未运行的 $ sudo docker ps -a # https://docs.docker.com/storage/volumes/ # 创建数据卷 $ sudo docker volume create grafana-storage
原文地址:https://www.cnblogs.com/jediz90/p/9221278.html
时间: 2024-11-08 13:37:16