Published November 10, 2020 by with 0 comment

Docker : How to install docker in linux

 

Hallo semua, pada kesempatan kali ini kita akan belajar tentang installasi docker pada sistem operasi Linux, dengan contoh di beberapa distribusi linux :

1. Install di Centos

```bash
# setup repository
$ sudo yum install -y yum-utils

$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

```

```bash
# install docker
$ sudo yum install docker-ce docker-ce-cli containerd.io
```

2. Install di Debian

```bash
# update package dan depedensi

$ sudo apt-get update
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

```

```bash
# add gpg key
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88

# add repo

# untuk x86_64 / amd64

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

# untuk armhf
$ sudo add-apt-repository \
   "deb [arch=armhf] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

# untuk arm64
$ sudo add-apt-repository \
   "deb [arch=arm64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

# standarnya menggunakan x86_64 / amd64
```

```bash
# install docker
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
```

3. Install di Fedora

```bash
# add repository
$ sudo dnf -y install dnf-plugins-core
$ sudo dnf config-manager \
    --add-repo \
    https://download.docker.com/linux/fedora/docker-ce.repo
```

```bash
# install docker
$ sudo dnf install docker-ce docker-ce-cli containerd.io
```

4. Install di Ubuntu

- install dari repo docker.com

```bash
# install dari repo resmi docker.com
# install dependensi
$ sudo apt-get update
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

# tambahkan key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88

# add repo

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

# install docker
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
```

- Install dari repo resmi ubuntu

```bash
$ sudo apt -y install docker.io 
```

5. Verifikasi

```bash
$ sudo docker info
$ sudo docker version

# jika non-root user
$ docker info
$ docker version
```

Jika kita hendak menjalankan docker dengan non-root user, perlu menambahkan user ke dalam group docker

```bash
$ sudo usermod -aG docker nama_user
```

Yaps, sekian dulu untuk tutorial kali ini, sampai jumpa di tutorial berikutnya!

      edit

0 comments:

Post a Comment