柚子快報激活碼778899分享:容器 運維 Docker安裝
柚子快報激活碼778899分享:容器 運維 Docker安裝
1、使用官方安裝腳本自動安裝
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
2、創(chuàng)建docker.service文件,進入 /etc/systemd/system/ 目錄,并創(chuàng)建 docker.service 文件,內(nèi)容如下,這樣可以將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. #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
# 此處的–insecure-registry=127.0.0.1(此處改成你私服ip)設(shè)置是針對有搭建了自己私服Harbor時允許docker進行不安全的訪問,否則訪問將會被拒絕。
3、啟動docker
# 給docker.service文件添加執(zhí)行權(quán)限
chmod +x /etc/systemd/system/docker.service
# 重新加載配置文件(每次有修改docker.service文件時都要重新加載下)
systemctl daemon-reload
# 啟動并設(shè)置開機啟動 systemctl enable docker.service --now
# 查看docker服務狀態(tài) [root@localhost system]# systemctl status docker
4、docker-compose安裝
# docker-compose下載并放到/usr/local/bin/下面: curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose # 下載好docker-compose的前提下,拷貝到指定位置 sudo cp docker-compose /usr/local/bin/docker-compose sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose sudo chmod +x /usr/bin/docker-compose docker-compose -v # 最后使用 docker-compose -v 命令測試是否安裝成功(如果提示“沒有那個文件或目錄”可以重啟下服務器再試試)
柚子快報激活碼778899分享:容器 運維 Docker安裝
相關(guān)閱讀
本文內(nèi)容根據(jù)網(wǎng)絡資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。