![](https://csdnimg.cn/release/download_crawler_static/88582074/bg1.jpg)
一,在虚拟机上安装 Docker 容器
1,在 Docker 的官网上下载适用于 linux 版本的并上传到/usr/local 目录下
2,解压这个压缩包
3,将解压出来的 docker 文件复制到 /usr/bin/ 目录下,执行命令 cp docker/* /usr/bin/
4. 创建 docker.service 文件
进入 /etc/systemd/system/ 目录,并创建 docker.service 文件,内容如下,这样可以将
docker 注册为 service 服务,执行命令 vi /etc/systemd/system/docker.service 并在文件中写
入如下的内容
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1
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.