docker官网二进制方式运行docker的方法

本文详细介绍了如何在Linux和macOS上手动从静态二进制文件安装Docker Engine。首先,确保你的系统满足64位安装、Linux内核版本、iptables、git和XZ Utils等前提条件。然后,下载并解压适用于你操作系统的Docker二进制文件,将它们移动到可执行路径,并启动Docker守护进程。对于macOS,只提供Docker客户端的二进制文件。最后,验证Docker是否正确安装,通过运行hello-world镜像进行测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

简单来说包含3个步骤

第一步:解压 tar vxzf file

第二部:复制到/esr/bin下把解压的文件,sudo cp file/* /usr/bin/

第三部:sudo dockerd &  //运行

 

测试 sudo docker run hello-world

 

 

Install Docker Engine from binaries

Estimated reading time: 5 minutes

Note: You may have been redirected to this page because there is no longer a dynamically-linked Docker package for your Linux distribution.

If you want to try Docker or use it in a testing environment, but you’re not on a supported platform, you can try installing from static binaries. If possible, you should use packages built for your operating system, and use your operating system’s package management system to manage Docker installation and upgrades. Be aware that 32-bit static binary archives do not include the Docker daemon.

Static binaries for the Docker daemon binary are only available for Linux (as dockerd). Static binaries for the Docker client are available for Linux and macOS (as docker).

This topic discusses binary installation for both Linux and macOS:

Install daemon and client binaries on Linux

Prerequisites

Before attempting to install Docker from binaries, be sure your host machine meets the prerequisites:

  • A 64-bit installation
  • Version 3.10 or higher of the Linux kernel. The latest version of the kernel available for your platform is recommended.
  • iptables version 1.4 or higher
  • git version 1.7 or higher
  • A ps executable, usually provided by procps or a similar package.
  • XZ Utils 4.9 or higher
  • A properly mounted cgroupfs hierarchy; a single, all-encompassing cgroup mount point is not sufficient. See Github issues #2683, #3485, #4568).

Secure your environment as much as possible

OS considerations

Enable SELinux or AppArmor if possible.

It is recommended to use AppArmor or SELinux if your Linux distribution supports either of the two. This helps improve security and blocks certain types of exploits. Review the documentation for your Linux distribution for instructions for enabling and configuring AppArmor or SELinux.

Security Warning

If either of the security mechanisms is enabled, do not disable it as a work-around to make Docker or its containers run. Instead, configure it correctly to fix any problems.

Docker daemon considerations

Install static binaries

  1. Download the static binary archive. Go to https://download.docker.com/linux/static/stable/ (or change stable to nightly or test), choose your hardware platform, and download the .tgz file relating to the version of Docker Engine you want to install.

  2. Extract the archive using the tar utility. The dockerd and docker binaries are extracted.

     
  •  tar xzvf /path/to/<FILE>.tar.gz
    
  • Optional: Move the binaries to a directory on your executable path, such as /usr/bin/. If you skip this step, you must provide the path to the executable when you invoke docker or dockerd commands.

     
  •  sudo cp docker/* /usr/bin/
    
  • Start the Docker daemon:

     
  •  sudo dockerd &
    

    If you need to start the daemon with additional options, modify the above command accordingly or create and edit the file /etc/docker/daemon.json to add the custom configuration options.

  • Verify that Docker is installed correctly by running the hello-world image.

     
  1.  sudo docker run hello-world
    

    This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Install client binaries on macOS

The macOS binary includes the Docker client only. It does not include the dockerd daemon.

  1. Download the static binary archive. Go to https://download.docker.com/mac/static/stable/x86_64/, (or change stable to nightly or test), and download the .tgz file relating to the version of Docker Engine you want to install.

  2. Extract the archive using the tar utility. The docker binary is extracted.

     
  •  tar xzvf /path/to/<FILE>.tar.gz
    
  • Optional: Move the binary to a directory on your executable path, such as /usr/local/bin/. If you skip this step, you must provide the path to the executable when you invoke docker or dockerd commands.

     
  •  sudo cp docker/docker /usr/local/bin/
    
  • Verify that Docker is installed correctly by running the hello-world image. The value of <hostname> is a hostname or IP address running the Docker daemon and accessible to the client.

     
  1.  sudo docker -H <hostname> run hello-world
    

    This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Upgrade static binaries

To upgrade your manual installation of Docker Engine, first stop any dockerd or dockerd.exe processes running locally, then follow the regular installation steps to install the new version on top of the existing version.

Next steps

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值