Panduan Mengenal dan Mengoperasikan Docker

Berikut catatan2 saya selama mempelajari docker. Tujuannya agar tidak lupa dan mudah kembali ke catatan2 ini nantinya. Nanti akan diperbaiki agar dapat menjadi tutorial yang mudah dipahami pembaca.

1. Melakukan Backup container
$ docker commit -p amquiz-v1 backup-amquiz-v1

2. Menyimpan backup image ke direktori kerja di ubuntu (di luar docker)

$ docker save -o backup-amquiz-v11.tar backup-amquiz-v1


3. Menjalankan image dengan mounting ke direktori aktif OS Host.
$ docker run -ti -v $(pwd):/mnt backup-amquiz-v1 bash

4. Menjalankan Images menjadi container
$docker run --name amquiz backup-amquiz-v1:latest

5. Menjalankan images menjadi container dengan melakukan mount direktori /var/log/nginx di dalam kontainer ke direktori /nginxlogs di direktori host.
$docker run -d -v ~/nginxlogs:/var/log/nginx -p 5000:80 -i nginx

Ket.
  • -v ~/nginxlogs:/var/log/nginx — We set up a volume that links the /var/log/nginx directory from inside the Nginx container to the ~/nginxlogsdirectory on the host machine. Docker uses a : to split the host's path from the container path, and the host path always comes first.
  • -d — Detach the process and run in the background. Otherwise, we would just be watching an empty Nginx prompt and wouldn't be able to use this terminal until we killed Nginx.
  • -p 5000:80 — Setup a port forward. The Nginx container is listening on port 80 by default, and this maps the Nginx container's port 80 to port 5000 on the host system.

Komentar

  1. Titanium vs Stainless Steel - the home of steel for
    Titanium, Titanium, titanium white wheels Steel titanium cartilage earrings is a very versatile tool that can be used mens titanium watches for applications on your ford focus titanium laptop or desk. A ford escape titanium for sale true steel, titanium is a  Rating: 4.8 · ‎4,320 reviews

    BalasHapus

Posting Komentar

Postingan populer dari blog ini

Cara Mudah Instalasi Framework Symfony di Windows 10

Mengaktifkan file rc.local di debian 9

Cara Upgrade Firmware Linksys WAP54G ke DD-WRT