docker設(shè)置自動(dòng)啟動(dòng)一,、docker服務(wù)設(shè)置自動(dòng)啟動(dòng)查看已啟動(dòng)的服務(wù)
查看是否設(shè)置開機(jī)啟動(dòng)
設(shè)置開機(jī)啟動(dòng)
關(guān)閉開機(jī)啟動(dòng)
二,、docker容器設(shè)置自動(dòng)啟動(dòng)啟動(dòng)時(shí)加--restart=always
restart參數(shù)說明:no 不自動(dòng)重啟容器. (默認(rèn)value) 如果項(xiàng)目非首次啟動(dòng),則使用update更新鏡像實(shí)現(xiàn)自動(dòng)啟動(dòng):
////////////////////////////////////////////////////////////////////////////////////////////// 1.查看docker服務(wù)是否開機(jī)啟動(dòng) # sudo systemctl list-unit-files | grep enable|grep docker snap-docker-796.mount enabled snap.docker.dockerd.service enabled
2.關(guān)閉docker開機(jī)自啟動(dòng) # systemctl disable snap.docker.dockerd.service Removed /etc/systemd/system/multi-user.target.wants/snap.docker.dockerd.service.
3.開啟docker開機(jī)自啟動(dòng) # systemctl enable snap.docker.dockerd.service
4.關(guān)閉docker服務(wù) # systemctl stop snap.docker.dockerd.service
5.啟動(dòng)docker服務(wù) # systemctl start snap.docker.dockerd.service
6.查看docker服務(wù)是否啟動(dòng) # sudo systemctl list-units --type=service|grep docker snap.docker.dockerd.service loaded active running Service for snap application docker.dockerd |
|