1. 기본 환경
1. 운영체제: CentOS 7.3
2. Docker 설치
1. 압축이 풀린 docker 파일의 내용을 이동합니다. /usr/bin/ 디렉터리
tar -xvf docker-18.06.1-ce.tgz
3. docker를 service
cp docker/* /usr/bin/
로 등록합니다. docker.service에 다음 구성을 추가하고 저장합니다.
vim /etc/systemd/system/docker.service
4. 시작
[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 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 the docker process if it exits prematurely Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target
5. 확인
chmod +x /etc/systemd/system/docker.service #添加文件权限并启动docker systemctl daemon-reload #重载unit配置文件 systemctl start docker #启动Docker systemctl enable docker.service #设置开机自启
추천 튜토리얼:
docker 튜토리얼위 내용은 Linux에서 인트라넷에 도커를 설치하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!