離線安裝docker

下載安裝包

如果服務(wù)器無法聯(lián)網(wǎng)從Docker倉庫安裝docker,那可以下載.rpm文件后手動解壓并安裝。

  1. https://download.docker.com/linux/centos/7/x86_64/stable/Packages/下載需要的docker版本的.rpm文件

Note: To install an edge package, change the word stable in the above URL to edge.Learn about stable and edge channels.

  1. 安裝Docker CE,改變路徑到docker安裝包目錄下。

  2. 安裝Docker

$ sudo rpm-ivh /path/to/package.rpm

現(xiàn)在docker已經(jīng)安裝了,但還未啟動。docker group已創(chuàng)建,但還沒有用戶添加到docker group里

  1. 啟動Docker.
$ sudo systemctl start docker
  1. 啟動一個hello-world鏡像來確認docker已安裝成功。
$ sudo docker run hello-world

這個命令下載了啟動了一個容器并在其中啟動了hello-world測試鏡像。當容器啟動后,會打印出一些信息,之后退出。

Docker CE is installed and running. You need to use sudo to run Docker commands. Continue to Post-installation steps for Linux to allow non-privileged users to run Docker commands and for other optional configuration steps.

UPGRADE DOCKER CE

To upgrade Docker CE, download the newer package file and repeat the installation procedure, using yum -y upgrade instead of yum -y install, and pointing to the new file.

注意:

error: Failed dependencies:

    container-selinux >= 2.9 is needed by docker-ce-18.06.1.ce-3.el7.x86_64

[root@gxfw dockerInstall]# rpm -ivh container-selinux-2.9-4.el7.noarch.rpm

warning: container-selinux-2.9-4.el7.noarch.rpm: Header V3 RSA/SHA256 Signature,

需要安裝依賴包 container-selinux-2.9-4.el7.noarch.rpm。

開啟docker管理端口

mkdir /etc/systemd/system/docker.service.d

cat > /etc/systemd/system/docker.service.d/tcp.conf <<EOF

[Service]

ExecStart=

ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375

EOF

systemctl daemon-reload

systemctl restart docker

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容