- 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
Legacy feature of Docker Network - Container Links
Hai semuanya, di materi kali ini kita akan membahas tentang Simple Networking dengan Docker Network Link.
Before the Docker networks feature, you could use the Docker link feature to allow containers to discover each other and securely transfer information about one container to another container.
Ok pertama kita siapkan dulu running container sebagai contoh disini saya mau menjalankan Web-Server dengan image nginx
seperti berikut:
For Bash script:
For Powershell script:
Connecting another containers using link system
Untuk membuat container links, Docker menggunakan nama container yang telah dibuat dan statusnya running. Seperti yang telah kita buat contohnya webapp
:
➜ ~ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
57f5f5084bf3 nginx "/docker-entrypoint.…" 58 minutes ago Up 58 minutes 80/tcp webapp
Jika kita mau connect ke container webapp
tersebut kita buat container baru dengan image ubuntu dan menjalankan perintah seperti berikut:
For Bash script:
For Powershell script:
Jika di jalankan maka hasilnya seperti berikut:
➜ ~ docker container run `
>> --rm `
>> --link webapp:nginx_dev `
>> ubuntu:21.04 `
>> bash -c "apt update -y && apt install curl -y && curl http://nginx_dev:80"
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
So what does linking the containers actually do? Docker exposes connectivity information for the source container to the recipient container in two ways:
- Environment variables,
- Updating the
/etc/hosts
file.
Seperti berikut:
➜ ~ docker inspect -f "{{ .HostConfig.Links }}" ubuntu
[/nginx-dev:/ubuntu/nginx-dev]
➜ ~ docker container run `
>> --rm `
>> --link webapp:nginx_dev `
>> ubuntu:21.04 `
>> bash -c "cat /etc/hosts"
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 nginx_dev 57f5f5084bf3 webapp
172.17.0.3 674f56f7b5e0
➜ ~ docker container run `
>> --rm `
>> --link webapp:nginx_dev `
>> ubuntu:21.04 `
>> env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=c69c0928aaeb
NGINX_DEV_PORT=tcp://172.17.0.2:80
NGINX_DEV_PORT_80_TCP=tcp://172.17.0.2:80
NGINX_DEV_PORT_80_TCP_ADDR=172.17.0.2
NGINX_DEV_PORT_80_TCP_PORT=80
NGINX_DEV_PORT_80_TCP_PROTO=tcp
NGINX_DEV_NAME=/flamboyant_vaughan/nginx_dev
NGINX_DEV_ENV_NGINX_VERSION=1.19.10
NGINX_DEV_ENV_NJS_VERSION=0.5.3
NGINX_DEV_ENV_PKG_RELEASE=1~buster
HOME=/root
Cleanup
Ok setelah kita coba membuat link, sekarang kita bersihkan dulu ya supaya tidak nyampah. berikut perintahnya:
Yuk simak juga videonya,
Dan jika temen-temen belajar hal baru kali ini jangan lupa buat Like, Subcribe, dan Share ke temen kalian. Terimakasih!!!
-
Referensi
https://docs.docker.com/network/links/