二进制部署docker
二进制部署 Docker
Install static binaries
-
Download the static binary archive. Go to https://download.docker.com/linux/static/stable/, choose your hardware platform, and download the
.tgz
file relating to the version of Docker Engine you want to install. -
Extract the archive using the
tar
utility. Thedockerd
anddocker
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 invokedocker
ordockerd
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.sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.
You have now successfully installed and started Docker Engine.
Configure Docker to start on boot with systemd
Many modern Linux distributions use systemd to manage which services start when the system boots. On Debian and Ubuntu, the Docker service starts on boot by default. To automatically start Docker and containerd on boot for other Linux distributions using systemd, run the following commands:
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
To stop this behavior, use disable
instead.
sudo systemctl disable docker.service
sudo systemctl disable containerd.service
If you need to add an HTTP proxy, set a different directory or partition for the Docker runtime files, or make other customizations, see customize your systemd Docker daemon options.
Manually create the systemd unit files
When installing the binary without a package manager, you may want to integrate Docker with systemd. For this, install the two unit files (service and socket) from the GitHub repository to /etc/systemd/system.
Leave a comment