Docker

Installera Docker för Kubernetes

First, update the existing repository in the machine with the following command:
$ apt-get update -y
$ sudo apt-get update
$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
2. Next, install a few prerequisite packages. These allow apt to use secure channels using HTTPS:
$ apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y

3. Then, add the GPG key from the official Docker repository:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker- archive-keyring.gpg
$curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. Add the Docker repository to the apt sources list (hela detta script):
$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

5. Next, update the package information with Docker packages from the apt sources list:
$ apt-get update -y

6. Finally, install Docker:
$apt-get install docker-ce docker-ce-cli containerd.io -y

7. Update the default Docker daemon configuration in /etc/docker/daemon.json by writing this full script:
$ cat <<EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF

8. Enable the process to start on boot, and reload the Docker daemon:
$ systemctl enable docker
$ systemctl daemon-reload
$ systemctl restart docker

9. Now, let's render the version information in an easy-to-read layout:
$ docker --version


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.