Docker 服务管理
- 启动服务:
sudo systemctl start docker - 停止服务:
sudo systemctl stop docker - 重启服务:
sudo systemctl restart docker - 查看状态:
sudo systemctl status docker - 开机自启:
sudo systemctl enable docker - 禁用自启:
sudo systemctl disable docker
容器基本操作
- 运行容器:
docker run可选择交互式-it或后台运行-d - 指定名称:
--name [container-name] - 端口映射:
-p [host-port]:[container-port] - 暴露端口:
--expose [container-port] - 挂载卷:
-v [host-dir]:[container-dir]或--mount type=bind,source=[host-dir],target=[container-dir] - 设置环境变量:
-e [env-var]=[value]或--env-file [file-path] - 连接网络:
--network [network-name] - 分配 IP:
--ip [container-ip]

最低0.47元/天 解锁文章
369

被折叠的 条评论
为什么被折叠?



