docker ce on Debian
<p>Note:</p><pre><code class="language-bash"># - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user
</code></pre>
<h1 id="docker-engine">Docker Engine</h1>
<pre><code># Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
</code></pre>
<h2 id="1-install">1. install</h2>
<pre><code class="language-bash">$sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
</code></pre>
<h3 id="docker-source">docker source</h3>
<pre><code>sudo systemctl daemon-reload
</code></pre>
<h4 id="源地址">源地址</h4>
<ul>
<li>/etc/docker/daemon.json</li>
</ul>
<pre><code>{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"https://mirror.ccs.tencentyun.com"
]
}
</code></pre>
<p>每次都要更新China源</p>
<h2 id="2-enable">2. enable</h2>
<pre><code class="language-bash">$ sudo systemctl start docker
$ sudo systemctl status docker
</code></pre>
<h3 id="test">test</h3>
<pre><code class="language-bash">$ docker --version
$ sudo docker run hello-world
</code></pre>
<h4 id="output-info">output info</h4>
<pre><code>Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
17eec7bbc9d7: Pull complete
ea52d2000f90: Download complete
Digest: sha256:d4aaab6242e0cace87e2ec17a2ed3d779d18fbfd03042ea58f2995626396a274
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
</code></pre>
<h1 id="docker-compose">Docker compose</h1>
<p>Install the Docker Compose standalone (Legacy)</p>
<h2 id="1-down">1. down</h2>
<pre><code class="language-bash">sudo curl -SL https://github.com/docker/compose/releases/download/v5.0.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
</code></pre>
<h2 id="2-exec">2. exec</h2>
<pre><code class="language-bash">sudo chmod +x /usr/local/bin/docker-compose
</code></pre>
<p>ou can also create a symbolic link to /usr/bin or any other directory in your path:</p>
<pre><code>sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
</code></pre>
<h3 id="test-1">test</h3>
<pre><code class="language-bash">tdtc@tdtc306:~$ docker-compose --version
Docker Compose version v5.0.1
</code></pre>
<h1 id="reference">Reference</h1>
<ul>
<li>Install Docker Compose</li>
<li>Install using the apt repository</li>
<li>docker - ubuntu</li>
</ul><br><br>
来源:https://www.cnblogs.com/xiaobin-hlj80/p/12907648.html
頁:
[1]