diff options
Diffstat (limited to 'devdocs/docker/engine%2Finstall%2Fdebian%2Findex.html')
| -rw-r--r-- | devdocs/docker/engine%2Finstall%2Fdebian%2Findex.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Finstall%2Fdebian%2Findex.html b/devdocs/docker/engine%2Finstall%2Fdebian%2Findex.html new file mode 100644 index 00000000..6e8eef64 --- /dev/null +++ b/devdocs/docker/engine%2Finstall%2Fdebian%2Findex.html @@ -0,0 +1,47 @@ +<h1>Install Docker Engine on Debian</h1> + +<p>To get started with Docker Engine on Debian, make sure you <a href="#prerequisites">meet the prerequisites</a>, then <a href="#installation-methods">install Docker</a>.</p> <h2 id="prerequisites">Prerequisites</h2> <h3 id="os-requirements">OS requirements</h3> <p>To install Docker Engine, you need the 64-bit version of one of these Debian or Raspbian versions:</p> <ul> <li>Debian Bullseye 11 (stable)</li> <li>Debian Buster 10 (oldstable)</li> <li>Raspbian Bullseye 11 (stable)</li> <li>Raspbian Buster 10 (oldstable)</li> </ul> <p>Docker Engine is supported on <code class="language-plaintext highlighter-rouge">x86_64</code> (or <code class="language-plaintext highlighter-rouge">amd64</code>), <code class="language-plaintext highlighter-rouge">armhf</code>, and <code class="language-plaintext highlighter-rouge">arm64</code> architectures.</p> <h3 id="uninstall-old-versions">Uninstall old versions</h3> <p>Older versions of Docker were called <code class="language-plaintext highlighter-rouge">docker</code>, <code class="language-plaintext highlighter-rouge">docker.io</code>, or <code class="language-plaintext highlighter-rouge">docker-engine</code>. If these are installed, uninstall them:</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo apt-get remove docker docker-engine docker.io containerd runc +</pre></div> <p>It’s OK if <code class="language-plaintext highlighter-rouge">apt-get</code> reports that none of these packages are installed.</p> <p>The contents of <code class="language-plaintext highlighter-rouge">/var/lib/docker/</code>, including images, containers, volumes, and networks, are preserved. If you do not need to save your existing data, and want to start with a clean installation, refer to the <a href="#uninstall-docker-engine">uninstall Docker Engine</a> section at the bottom of this page.</p> <h2 id="installation-methods">Installation methods</h2> <p>You can install Docker Engine in different ways, depending on your needs:</p> <ul> <li> <p>Most users <a href="#install-using-the-repository">set up Docker’s repositories</a> and install from them, for ease of installation and upgrade tasks. This is the recommended approach, except for Raspbian.</p> </li> <li> <p>Some users download the DEB package and <a href="#install-from-a-package">install it manually</a> and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.</p> </li> <li> <p>In testing and development environments, some users choose to use automated <a href="#install-using-the-convenience-script">convenience scripts</a> to install Docker. This is currently the only approach for Raspbian.</p> </li> </ul> <h3 id="install-using-the-repository">Install using the repository</h3> <p>Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.</p> <blockquote> <p><strong>Raspbian users cannot use this method!</strong></p> <p>For Raspbian, installing using the repository is not yet supported. You must instead use the <a href="#install-using-the-convenience-script">convenience script</a>.</p> </blockquote> <h4 id="set-up-the-repository">Set up the repository</h4> <ol> <li> <p>Update the <code class="language-plaintext highlighter-rouge">apt</code> package index and install packages to allow <code class="language-plaintext highlighter-rouge">apt</code> to use a repository over HTTPS:</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo apt-get update + +$ sudo apt-get install \ + ca-certificates \ + curl \ + gnupg \ + lsb-release +</pre></div> </li> <li> <p>Add Docker’s official GPG key:</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo mkdir -p /etc/apt/keyrings +$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +</pre></div> </li> <li> <p>Use the following command to set up the repository:</p> <div class="highlight"><pre class="highlight" data-language="">$ echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +</pre></div> </li> </ol> <h4 id="install-docker-engine">Install Docker Engine</h4> <p>This procedure works for Debian on <code class="language-plaintext highlighter-rouge">x86_64</code> / <code class="language-plaintext highlighter-rouge">amd64</code>, <code class="language-plaintext highlighter-rouge">armhf</code>, <code class="language-plaintext highlighter-rouge">arm64</code>, and Raspbian.</p> <ol> <li> <p>Update the <code class="language-plaintext highlighter-rouge">apt</code> package index, and install the <em>latest version</em> of Docker Engine, containerd, and Docker Compose, or go to the next step to install a specific version:</p> <div class="highlight"><pre class="highlight" data-language=""> $ sudo apt-get update + $ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin +</pre></div> <blockquote> <p>Receiving a GPG error when running <code class="language-plaintext highlighter-rouge">apt-get update</code>?</p> <p>Your default umask may not be set correctly, causing the public key file for the repo to not be detected. Run the following command and then try to update your repo again: <code class="language-plaintext highlighter-rouge">sudo chmod a+r /etc/apt/keyrings/docker.gpg</code>.</p> </blockquote> </li> <li> <p>To install a <em>specific version</em> of Docker Engine, list the available versions in the repo, then select and install:</p> <p>a. List the versions available in your repo:</p> <div class="highlight"><pre class="highlight" data-language="">$ apt-cache madison docker-ce + + docker-ce | 5:18.09.1~3-0~debian-stretch | https://download.docker.com/linux/debian stretch/stable amd64 Packages + docker-ce | 5:18.09.0~3-0~debian-stretch | https://download.docker.com/linux/debian stretch/stable amd64 Packages + docker-ce | 18.06.1~ce~3-0~debian | https://download.docker.com/linux/debian stretch/stable amd64 Packages + docker-ce | 18.06.0~ce~3-0~debian | https://download.docker.com/linux/debian stretch/stable amd64 Packages +</pre></div> <p>b. Install a specific version using the version string from the second column, for example, <code class="language-plaintext highlighter-rouge">5:18.09.1~3-0~debian-stretch</code>.</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io docker-compose-plugin +</pre></div> </li> <li> <p>Verify that Docker Engine is installed correctly by running the <code class="language-plaintext highlighter-rouge">hello-world</code> image.</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo docker run hello-world +</pre></div> <p>This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.</p> </li> </ol> <p>Docker Engine is installed and running. The <code class="language-plaintext highlighter-rouge">docker</code> group is created but no users are added to it. You need to use <code class="language-plaintext highlighter-rouge">sudo</code> to run Docker commands. Continue to <a href="../linux-postinstall/index">Linux postinstall</a> to allow non-privileged users to run Docker commands and for other optional configuration steps.</p> <h4 id="upgrade-docker-engine">Upgrade Docker Engine</h4> <p>To upgrade Docker Engine, first run <code class="language-plaintext highlighter-rouge">sudo apt-get update</code>, then follow the <a href="#install-using-the-repository">installation instructions</a>, choosing the new version you want to install.</p> <h3 id="install-from-a-package">Install from a package</h3> <p>If you cannot use Docker’s repository to install Docker Engine, you can download the <code class="language-plaintext highlighter-rouge">.deb</code> file for your release and install it manually. You need to download a new file each time you want to upgrade Docker.</p> <ol> <li> <p>Go to <a href="https://download.docker.com/linux/debian/dists/" target="_blank" rel="noopener" class="_"><code class="language-plaintext highlighter-rouge">https://download.docker.com/linux/debian/dists/</code></a>, choose your Debian version, then browse to <code class="language-plaintext highlighter-rouge">pool/stable/</code>, choose <code class="language-plaintext highlighter-rouge">amd64</code>, <code class="language-plaintext highlighter-rouge">armhf</code>, or <code class="language-plaintext highlighter-rouge">arm64</code>, and download the <code class="language-plaintext highlighter-rouge">.deb</code> file for the Docker Engine version you want to install.</p> </li> <li> <p>Install Docker Engine, changing the path below to the path where you downloaded the Docker package.</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo dpkg -i /path/to/package.deb +</pre></div> <p>The Docker daemon starts automatically.</p> </li> <li> <p>Verify that Docker Engine is installed correctly by running the <code class="language-plaintext highlighter-rouge">hello-world</code> image.</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo docker run hello-world +</pre></div> <p>This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.</p> </li> </ol> <p>Docker Engine is installed and running. The <code class="language-plaintext highlighter-rouge">docker</code> group is created but no users are added to it. You need to use <code class="language-plaintext highlighter-rouge">sudo</code> to run Docker commands. Continue to <a href="../linux-postinstall/index">Post-installation steps for Linux</a> to allow non-privileged users to run Docker commands and for other optional configuration steps.</p> <h4 id="upgrade-docker-engine-1">Upgrade Docker Engine</h4> <p>To upgrade Docker Engine, download the newer package file and repeat the <a href="#install-from-a-package">installation procedure</a>, pointing to the new file.</p> <h3 id="install-using-the-convenience-script">Install using the convenience script</h3> <p>Docker provides a convenience script at <a href="https://get.docker.com/">get.docker.com</a> to install Docker into development environments quickly and non-interactively. The convenience script is not recommended for production environments, but can be used as an example to create a provisioning script that is tailored to your needs. Also refer to the <a href="#install-using-the-repository">install using the repository</a> steps to learn about installation steps to install using the package repository. The source code for the script is open source, and can be found in the <a href="https://github.com/docker/docker-install" target="_blank" rel="noopener" class="_"><code class="language-plaintext highlighter-rouge">docker-install</code> repository on GitHub</a>.</p> <p class="warning">Always examine scripts downloaded from the internet before running them locally. Before installing, make yourself familiar with potential risks and limitations of the convenience script:</p> <ul> <li>The script requires <code class="language-plaintext highlighter-rouge">root</code> or <code class="language-plaintext highlighter-rouge">sudo</code> privileges to run.</li> <li>The script attempts to detect your Linux distribution and version and configure your package management system for you, and does not allow you to customize most installation parameters.</li> <li>The script installs dependencies and recommendations without asking for confirmation. This may install a large number of packages, depending on the current configuration of your host machine.</li> <li>By default, the script installs the latest stable release of Docker, containerd, and runc. When using this script to provision a machine, this may result in unexpected major version upgrades of Docker. Always test (major) upgrades in a test environment before deploying to your production systems.</li> <li>The script is not designed to upgrade an existing Docker installation. When using the script to update an existing installation, dependencies may not be updated to the expected version, causing outdated versions to be used.</li> </ul> <blockquote> <p>Tip: preview script steps before running</p> <p>You can run the script with the <code class="language-plaintext highlighter-rouge">DRY_RUN=1</code> option to learn what steps the script will execute during installation:</p> <div class="highlight"><pre class="highlight" data-language="">$ curl -fsSL https://get.docker.com -o get-docker.sh +$ DRY_RUN=1 sh ./get-docker.sh +</pre></div> </blockquote> <p>This example downloads the script from <a href="https://get.docker.com/">get.docker.com</a> and runs it to install the latest stable release of Docker on Linux:</p> <div class="highlight"><pre class="highlight" data-language="">$ curl -fsSL https://get.docker.com -o get-docker.sh +$ sudo sh get-docker.sh +Executing docker install script, commit: 7cae5f8b0decc17d6571f9f52eb840fbc13b2737 +<...> +</pre></div> <p>Docker is installed. The <code class="language-plaintext highlighter-rouge">docker</code> service starts automatically on Debian based distributions. On <code class="language-plaintext highlighter-rouge">RPM</code> based distributions, such as CentOS, Fedora, RHEL or SLES, you need to start it manually using the appropriate <code class="language-plaintext highlighter-rouge">systemctl</code> or <code class="language-plaintext highlighter-rouge">service</code> command. As the message indicates, non-root users cannot run Docker commands by default.</p> <blockquote> <p><strong>Use Docker as a non-privileged user, or install in rootless mode?</strong></p> <p>The installation script requires <code class="language-plaintext highlighter-rouge">root</code> or <code class="language-plaintext highlighter-rouge">sudo</code> privileges to install and use Docker. If you want to grant non-root users access to Docker, refer to the <a href="../linux-postinstall/index#manage-docker-as-a-non-root-user">post-installation steps for Linux</a>. Docker can also be installed without <code class="language-plaintext highlighter-rouge">root</code> privileges, or configured to run in rootless mode. For instructions on running Docker in rootless mode, refer to <a href="../../security/rootless/index">run the Docker daemon as a non-root user (rootless mode)</a>.</p> </blockquote> <h4 id="install-pre-releases">Install pre-releases</h4> <p>Docker also provides a convenience script at <a href="https://test.docker.com/">test.docker.com</a> to install pre-releases of Docker on Linux. This script is equivalent to the script at <code class="language-plaintext highlighter-rouge">get.docker.com</code>, but configures your package manager to enable the “test” channel from our package repository, which includes both stable and pre-releases (beta versions, release-candidates) of Docker. Use this script to get early access to new releases, and to evaluate them in a testing environment before they are released as stable.</p> <p>To install the latest version of Docker on Linux from the “test” channel, run:</p> <div class="highlight"><pre class="highlight" data-language="">$ curl -fsSL https://test.docker.com -o test-docker.sh +$ sudo sh test-docker.sh +<...> +</pre></div> <h4 id="upgrade-docker-after-using-the-convenience-script">Upgrade Docker after using the convenience script</h4> <p>If you installed Docker using the convenience script, you should upgrade Docker using your package manager directly. There is no advantage to re-running the convenience script, and it can cause issues if it attempts to re-add repositories which have already been added to the host machine.</p> <h2 id="uninstall-docker-engine">Uninstall Docker Engine</h2> <ol> <li> <p>Uninstall the Docker Engine, CLI, Containerd, and Docker Compose packages:</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-compose-plugin +</pre></div> </li> <li> <p>Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:</p> <div class="highlight"><pre class="highlight" data-language="">$ sudo rm -rf /var/lib/docker +$ sudo rm -rf /var/lib/containerd +</pre></div> </li> </ol> <p>You must delete any edited configuration files manually.</p> <h2 id="next-steps">Next steps</h2> <ul> <li>Continue to <a href="../linux-postinstall/index">Post-installation steps for Linux</a>.</li> <li>Review the topics in <a href="https://docs.docker.com/develop/">Develop with Docker</a> to learn how to build new applications using Docker.</li> </ul> +<p><a href="https://docs.docker.com/search/?q=requirements">requirements</a>, <a href="https://docs.docker.com/search/?q=apt">apt</a>, <a href="https://docs.docker.com/search/?q=installation">installation</a>, <a href="https://docs.docker.com/search/?q=debian">debian</a>, <a href="https://docs.docker.com/search/?q=install">install</a>, <a href="https://docs.docker.com/search/?q=uninstall">uninstall</a>, <a href="https://docs.docker.com/search/?q=upgrade">upgrade</a>, <a href="https://docs.docker.com/search/?q=update">update</a></p> +<div class="_attribution"> + <p class="_attribution-p"> + © 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br> + <a href="https://docs.docker.com/engine/install/debian/" class="_attribution-link">https://docs.docker.com/engine/install/debian/</a> + </p> +</div> |
