Docker
简介
部署
镜像管理
容器管理
自定义镜像
commit
Dockerfile
dockerfile创建yum镜像
dockerfile创建ssh镜像
dockerfile创建http镜像
自定义仓库
存储持久化
自定义网络
端口映射
本文档使用 MrDoc 发布
-
+
首页
部署
## 安装 docker ### 官方脚本安装 centos部署 ```asp curl -fsSL https://get.docker.com | bash -s docker ``` ubuntu部署 ```asp apt -y install docker.io ``` ```asp apt -y install docker-compose ``` redhat部署 ```asp yum install -y yum-utils device-mapper-persistent-data lvm2 ``` ```asp yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo ``` ```asp yum install -y docker-ce ``` ### 离线安装 下载[官方安装包](https://download.docker.com/linux/static/stable/x86_64/ "官方") ```asp wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz ``` 解压本地安装包 ```asp tar -zxf docker-24.0.7.tgz ``` 解压文件移动至/usr/bin ```asp cp -p docker/* /usr/bin/ ``` 将docker注册为系统服务 ```asp vim /usr/lib/systemd/system/docker.service ``` ```asp [Unit] Description=Docker Application Container Engine Documentation=http://docs.docker.com After=network.target docker.socket [Service] Type=notify EnvironmentFile=-/run/flannel/docker WorkingDirectory=/usr/local/bin ExecStart=/usr/bin/dockerd \ -H tcp://0.0.0.0:4243 \ -H unix:///var/run/docker.sock \ --selinux-enabled=false \ --log-opt max-size=1g ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process Restart=on-failure [Install] WantedBy=multi-user.target ``` 重新加载daemon ```asp systemctl daemon-reload ``` 设置开机自启 ```asp systemctl enable docker ``` 启动服务 ```asp systemctl start docker ``` 查看版本 ```asp docker -v ``` 查看命令帮助 ```asp docker -help ``` ## 安装 dokcer-compose docker-compose官方下载地址:https://github.com/docker/compose/releases 下载(版本号:2.24.2) ```asp wget -P /bin/ https://pan.cddone.com/d/code/docker-compose ``` 添加权限 ```asp chmod +x /bin/docker-compose ``` 查看版本 ```asp docker-compose -v ```
done
2024年9月24日 15:11
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码