Categories: Linux

Contoh Perintah Docker

Melihat list container yang aktif

docker ps

Melihat semua list container

docker ps -a

Me-list semua images

docker images

Build docker image from Dockerfile

docker build -t <tag-name> <Dockerfile-dir>

Run docker container sekali jalan

docker run <images-name>

Run docker container secara interactive (misal untuk menjalankan bash)

docker run -it <images-name> <runnable-apps>
docker run -it ubuntu bash

Run docker container secara daemonized

docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"

Melihat logs docker yang berjalan secara daemonized

docker logs [-f] <container-id>

atau

docker logs [-f] <ports-name>

Run docker container

docker run <image name> <executable file> <param of executable file>
docker run ubuntu echo aaaaa

Run docker container dengan random port mapping

docker run -d -P training/webapp python app.py

Run docker container dengan defined port mapping

docker run -d -p 80:5000 training/webapp python app.py

Masuk ke container shell

docker exec -it <ports-name> /bin/bash

Keluar dari shell tanpa memberhentikan container

ctrl+p, kemudian ctrl+q

Stop docker container

docker stop <container-id>

atau

docker stops <ports-name>

Remove docker images

docker rmi <image-tag>

Remove docker container

docker rm <container-id>

atau

docker rm <ports-name>

Stop all container

docker stop $(docker ps -a -q)

Remove all container

docker rm $(docker ps -a -q)

Remove all images

docker rmi $(docker images -q)

 

 

 

 

Akhmad Fakhoni Listiyan Dede

Share
Published by
Akhmad Fakhoni Listiyan Dede

Recent Posts

Install kubernetes cluster using kubeadm

Hello everyone! 👋 Welcome to our step-by-step guide on using kubeadm to install Kubernetes. It's…

10 months ago

Meningkatkan Efisiensi Memory Proxmox Lebih dari 20%

Proxmox adalah hypervisor yang populer digunakan karena penggunaannya yang cukup simpel jika dibandingkan dengan hypervisor…

4 years ago

Longhorn Failed Upgrade from v0.8.1 to v1.0.0 caused by pv created before v0.6.2

This post is mirror of https://forums.rancher.com/t/failed-upgrade-from-v0-8-1-to-v1-0-0-caused-by-pv-created-before-v0-6-2/17586 I scale down all pods that has vpc to…

4 years ago

Cara Setup Network Ubuntu Server 18.04 pada Proxmox

Ubuntu Konfigurasi network pada Ubuntu Server 18.04 berbeda dengan ubuntu versi sebelumnya. Versi sebelumnya menggunakan…

4 years ago

VSCode Terminal Font Fix on MacOS

For detailed problems, see https://notulensiku.com/2019/02/fix-integrated-terminal-font-vscode/ To solve on mac, you need to install powerline fonts…

5 years ago

Enable Forward Secrecy pada Apache

Untuk mengaktifkan Forward Secrecy pada web browser Apache, versi minimum yang dibutuhkan adalah: OpenSSL 1.0.1c+Apache…

5 years ago