- person Penulis:
-
Dimas Maryanto
PT. Tabeldata Informatika
- account_balance_wallet Donasi via:
- Saweria a/n Dimas Maryanto
- lock_open Join Premium Members:
- Udemy.com
-
Daftar Materi
-
1. Pengenalan Docker 8
-
2. Docker Registry 3
-
3. Docker Container CLI 8
-
1. Docker CLI (Command Line Interface)
2. Management Docker Container
3. Management Docker Images
4. Run a command in a running container
5. Expose services to outside using ports
6. Copying files/content between container and filesystem
7. Logging, Inspect, & Resource Usage Statistics Containers
8. Run a Container using Environtment File
-
4. Docker Networks 7
-
5. Docker Volumes 5
-
6. Dockerfile 15
-
1. Build Docker Image Overview
2. Usage docker build
3. FROM Instruction
4. Environtment Replacement
5. Copying Resources
6. Excluding files/directories
7. Label Instruction
8. Execution Instruction
9. CMD vs ENTRYPOINT?
10. Exposing Ports
11. User, Volumes and Working Directory
12. Health Check Instruction
13. Multiple Stage Builds
14. Best practices for writing Dockerfiles
15. Best practices for scanning images
-
7. Study Kasus: Build docker image 14
-
1. Build specific docker image by programming languages
2. Build Docker Image for Java Webapp
3. Build Java Web using maven-docker-plugin
4. Build docker image for spring-boot
5. Springboot - using Environtment
6. Springboot - where data such as files/images we stored?
7. Springboot - Using Database
8. Build docker image for Angular Project
9. Angular - Access Rest API
10. Angular - Proxy to backend
11. Build docker image for PHP
12. Build Docker image for Laravel Framework
13. Laravel - Using Frontend & Rest API
14. Laravel - Using Database
-
8. Docker Compose 19
-
1. Overview of Docker Compose
2. Get started with Docker Compose
3. Overview of docker-compose CLI
4. Compose file specification and syntax
5. Environment variables in Compose
6. Volume in Compose
7. Share data between Containers in Compose
8. Using sshfs for share data in Compose
9. Using NFS for share data in Compose
10. Networking Overview in Compose file
11. Network links in Compose file
12. Specify custom networks in Compose file
13. Dependency between services in Compose file
14. Build docker image using Compose file
15. Using profiles with Compose file
16. Multiple Compose files to Add & Override attribute
17. Example use case of multiple compose files
18. Scale services using compose command
19. Use Compose in production
-
9. Study Kasus: Docker Compose 7
-
10. Docker Context 8
-
11. Study Kasus: Docker for CI 8
-
1. Overview of Study Cases using docker for CI
2. Setup environment for CI using Gitlab & Nexus OSS
3. The `.gitlab-ci.yml` file
4. Pipeline: PHP deployment using Gitlab CI
5. Pipeline: Java Web deployment using Gitlab CI
6. Pipeline: spring-boot deploy with Gitlab CI
7. Pipeline: Angular deploy with Gitlab CI
8. Pipeline: Laravel deploy with Gitlab CI
-
12. Docker Machine 7
-
13. Study Kasus: Ansible for Docker 4
-
14. Docker Swarm
- Materi: belum tersedia...
-
15. Study Kasus: Docker Swarm
- Materi: belum tersedia...
-
16. Docker on Cloud using GCP
- Materi: belum tersedia...
- Lastest Posts
- 09 Apr 23 Working with Deployment object
- 26 Feb 23 Study cases: Microservice apps (...
- 05 Feb 23 Welcome to the Nutanix HCF (Hybr...
- 04 Feb 23 Silabus SRE - Nutanix AHV: Pemul...
- 17 Jan 23 What is Workload Resources?
- 17 Jan 23 Overview Kubernetes Workloads re...
- 15 Jan 23 Getting started with Transaction...
- 14 Jan 23 Overview of Concurrency Control
- 14 Jan 23 Time your practice (part 3)
- 08 Jan 23 Cleanup Data from Table
Compose file specification and syntax
Hai semuanya di materi kali ini kita akan membahas basic syntax dalam penulisan Compose file, diantaranya yang akan kita bahas yaitu
- Compose file version
- Service configuration reference
- Volume configuration reference
- Network configuration reference
Ok langsung ja kita kepembahasan yang pertama yaitu
Compose file version
There are several versions of the Compose file format – 1
, 2
, 2.x
, and 3.x
.The Compose file formats are now described in these references, specific to each version.
The latest Compose file format is defined by the Compose Specification and is implemented by Docker Compose 1.27.0+.
Several things differ depending on which version you use:
- The structure and permitted configuration keys
- The minimum Docker Engine version you must be running
- Compose’s behaviour with regards to networking
Berikut adalah table compatibility matrix
Compose file format | Docker engine release |
---|---|
3.8 |
19.03.0+ |
3.7 |
18.06.0+ |
3.6 |
18.02.0+ |
3.5 |
17.12.0+ |
3.4 |
17.09.0+ |
3.3 |
17.06.0+ |
3.2 |
17.04.0+ |
so in this tutorial we will covers latest version docker-compose file which is version 3.x
, contoh penggunaanya seperti berikut
Service configuration reference
A service definition contains configuration that is applied to each container started for that service, much like passing command-line parameters to docker run
. Likewise, network and volume definitions are analogous to docker network create
and docker volume create
.
As with docker run
, options specified in the Dockerfile, such as CMD
, EXPOSE
, VOLUME
, ENV
, are respected by default - you don’t need to specify them again in docker-compose.yml.
Berikut adalah beberapa list yang termasuk service configuration yang sering saya gunakan pada compose file specification version 3.x
diantaranya:
- build
- command
- depends_on
- deploy
- dns
- dns_search
- entrypoint
- env_file
- environment
- healthcheck
- image
- networks
- ports
- profiles
- restart
- volumes
Volume configuration reference
While it is possible to declare volumes on the fly as part of the service declaration, this section allows you to create named volumes that can be reused across multiple services (without relying on volumes_from), and are easily retrieved and inspected using the docker command line or API. See the docker volume subcommand documentation for more information.
See use volumes and volume plugins for general information on volumes
Berikut adalah beberapa list yang termasuk volume configuration yang sering saya gunakan pada compose file specification version 3.x
diantaranya:
Network configuration reference
The top-level networks
key lets you specify networks to be created.
Berikut adalah beberapa list yang termasuk networking config yang sering saya gunakan pada compose file specification version 3.x
diantaranya:
Examples
For example if you wont run docker config like this:
First you need create/define a file docker-compose.yaml
like this:
Setelah itu kita bisa jalankan menggunakan perintah
Jika dijalankan maka outputnya seperti berikut:
➜ 09-docker-compose docker-compose -f .\docker-compose.yaml up -d
Creating network "09-docker-compose_backend" with the default driver
Creating volume "09-docker-compose_pg_data" with default driver
➜ 09-docker-compose ✗ docker-compose ps
Name Command State Ports
---------------------------------------------------------------------------------------------------------
09-docker-compose_db_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp,:::5432->5432/tcp
➜ 09-docker-compose docker container inspect 09-docker-compose_db_1 -f '{{json .Config.Env}}' | python.exe -m json.tool
[
"POSTGRES_PASSWORD=password",
"POSTGRES_USER=test_sit_user",
"POSTGRES_DB=test_sit_db"
]
➜ 09-docker-compose docker network ls
NETWORK ID NAME DRIVER SCOPE
8896f4f5181c 09-docker-compose_backend bridge local
➜ 09-docker-compose docker volume ls
DRIVER VOLUME NAME
local 09-docker-compose_pg_data
➜ 09-docker-compose docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
08e9f406c84a postgres:12.6 "docker-entrypoint.s…" 12 minutes ago Up 12 minutes 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp 09-docker-compose_db_1
Jadi kedepannya kita tidak perlu lagi mengingat config yang kita perlu run, cukup menggunakan template docker-compose.yaml
dan perintah docker-compose up
done!.
Yuk simak juga videonya,
Dan jika temen-temen belajar hal baru kali ini jangan lupa buat Like, Subcribe, dan Share ke temen kalian. Terimakasih!!!