离线安装docker

下载安装包

如果服务器无法联网从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

现在docker已经安装了,但还未启动。docker group已创建,但还没有用户添加到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

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容