Skip to content

Instantly share code, notes, and snippets.

@dimMaryanto93
Last active August 6, 2023 06:09
Show Gist options
  • Save dimMaryanto93/d92bd18da1c73c230d7762361f738524 to your computer and use it in GitHub Desktop.
Save dimMaryanto93/d92bd18da1c73c230d7762361f738524 to your computer and use it in GitHub Desktop.
Docker + Swarm: Pemula sampai Mahir

DevOps Docker: Pemula sampai Mahir

Belajar menjadi DevOps menggunakan Docker buat temen-temen yang masih pemula sampai mahir, Materi yang dibahas diantaranya

  1. Docker Container
  2. Docker Volume
  3. Docker Network
  4. Docker Dockerfile
  5. Docker Compose
  6. Docker Machine
  7. Docker Swarm
[wsl2]
memory=4GB # Limits VM memory in WSL 2 to 4 GB
processors=4 # Makes the WSL 4 VM use two virtual processors
# for windows 10 (2004)
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# for windows 10 (1903, 1909)
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
wsl --set-default-version 2
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
## create group if not exists
sudo groupadd docker
## execute this
sudo usermod -aG docker $USER
# Allows container to container communication, the solution to the problem
firewall-cmd --zone=public --add-masquerade --permanent
# Allow port 2375 expose to outside network
firewall-cmd --zone=public --add-port=2375/tcp --permanent
# reload the firewall
firewall-cmd --reload
dnf install docker-ce docker-ce-cli containerd.io
dnf install dnf-utils device-mapper-persistent-data lvm2 fuse-overlayfs wget
systemctl enable --now docker
systemctl restart docker.service
Set-ExecutionPolicy RemoteSigned | `
Set-ExecutionPolicy Restricted
Import-Module posh-git
Import-Module oh-my-posh
Import-Module posh-docker
Set-PoshPrompt -Theme robbyrussel
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck
Install-Module -Scope CurrentUser posh-docker
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"copyOnSelect": false,
"copyFormatting": false,
"profiles":
{
"defaults": { "colorScheme": "One Half Dark", "fontFace": "Cascadia Code PL" },
"list":
[
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
}
]
},
"schemes": [],
"actions":
[
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
{ "command": "find", "keys": "ctrl+shift+f" },
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
docker exec -it <container-name> psql -U postgres data_db
docker image ls
## or simply using
docker images
docker logs --follow <container-name>
docker stop container <container-name>
docker container prune
docker volume prune
docker network prune
docker container run \
--name postgres_db \
-p 5432:5432 \
-v /var/lib/postgresql/data \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=data_db \
-d \
postgres
docker container run `
--name postgres_db `
-p 5432:5432 `
-v /var/lib/postgresql/data `
-e POSTGRES_PASSWORD=password `
-d `
postgres:12.6
docker pull 192.168.88.50:8086/postgresql:9.3
~ docker pull mysql:5.7 `
| docker tag mysql:5.7 192.168.88.50:8087/database/mysql:5.7 `
| docker push 192.168.88.50:8087/database/mysql:5.7
tar -zxvf nexus-<version>.unix.tar.gz
sudo firewall-cmd --zone=public --add-port=8086/tcp --permanent && \
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --add-port=8087/tcp --permanent && \
sudo firewall-cmd --reload
sudo mkdir -p /opt/nexus && \
sudo mv nexus-<version> /opt/nexus
## create symbolic executeable
cd /opt/nexus && \
ln -s nexus-<version>/bin/nexus nexus
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
ExecStart=/opt/nexus/nexus start
ExecStop=/opt/nexus/nexus stop
LimitNOFILE=65536
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
systemctl enable --now nexus.service
docker container kill my_db
docker container ls \
--filter "label=env=production"
docker container ls `
--filter "label=env=production"
docker container ls \
--format "{{ .ID }} label: {{ .Labels }} => {{ .Ports }} status: {{ .Status }}"
docker container ls `
--format "{{ .ID }} label: {{ .Labels }} => {{ .Ports }} status: {{ .Status }}"
docker container pause my_db
docker container prune
docker container rm my_db
docker container start my_db
docker container stop my_db
docker container unpause my_db
docker container run \
--name my_db \
--env POSTGRES_PASSWORD=password \
--publish 5431:5432 \
--volume /var/lib/postgresql/data \
--label env=production \
--detach \
postgres:12.3
docker container run `
--name my_db `
--env POSTGRES_PASSWORD=password `
--publish 5431:5432 `
--volume /var/lib/postgresql/data `
--label env=production `
--detach `
postgres:12.3
docker image save -o backup-postgres.tar postgres:9.6
docker images postgres
# or spesific tag
docker images postgres:12.3
docker image load -i backup-postgres.tar
docker rmi nginx postgres:12.3
# or by id
docker image rm 62d49f9bab67 b03968f50f0e
docker image rm $(docker images postgres -q)
docker image rm mysql:5.7
# or by id
docker image rm 62d49f9bab67
docker container rm -f ubuntu_bash webapp postgres_db && \
docker volume prune
docker exec -it -u www-data -w /usr/share/nginx webapp bash
docker exec -i -t -w /contoh -u root ubuntu_bash bash
docker exec -u postgres -it postgres_db psql
docker exec ubuntu_bash \
bash -c "mkdir -p /contoh && echo 'Halo saya Dimas Maryanto, sedang belajar docker' > /contoh/test.txt"
docker exec -it ubuntu_bash bash
docker container rm -f \
nginx-private nginx-localhost nginx-localnetwork nginx-worldwide
docker container run --name nginx-worldwide -d -p 8090:80 nginx && \
docker container run --name nginx-localnetwork -d -p 192.168.88.254:8080:80 nginx && \
docker container run --name nginx-localhost -d -p 127.0.0.1:80:80 nginx
docker container rm -f webapp
docker cp webapp:/etc/nginx/ .
docker cp 04e-nginx-halo.html webapp:/usr/share/nginx/html/belajar.html && \
docker exec webapp ls /usr/share/nginx/html
docker container run \
--name webapp -p 80:80 nginx
<html>
<head>
<title>Belajar Docker</title>
</head>
<body>
<h3>Docker Container nginx</h3>
<p>Hai semuanya, ini adalah contoh paragraf menggunakan syntax html</p>
</body>
</html>
docker container rm -f mydb_stats nginx_stats pgdb_stats && \
docker network prune && \
docker volume prune
docker container inspect nginx_stats
docker logs pg_failed_init
docker network inspect brige
docker stats --all --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
docker volume inspect 3b0aff9e8f40576d5867290f9d2c1571d9cfd7cc3ad5751809bb5cca10b31687
# write file .env on your project folder
POSTGRES_PASSWORD=password
POSTGRES_USER=root
POSTGRES_DB=example_db
docker run --name postgres_envfile --env-file .env -d postgres:12.6
docker container run \
--name postgres_env \
-e POSTGRES_USER=root \
-e POSTGRES_DB=example_db \
-e POSTGRES_PASSWORD=password \
-d \
postgres:12.6
docker container run `
--name postgres_env `
-e POSTGRES_USER=root `
-e POSTGRES_DB=example_db `
-e POSTGRES_PASSWORD=password `
-d `
postgres:12.6
docker container rm -f webapp ubuntu && \
docker volume prune && \
docker network prune
docker container run \
--name webapp -d nginx
docker container run `
--name webapp -d nginx
docker container run `
-it `
--name ubuntu `
--rm ubuntu:21.04 `
bash -c "apt update -y && apt install curl -y && curl http://172.17.0.2:80"
docker container run `
-it `
--name ubuntu `
--rm ubuntu:21.04 `
bash -c "apt update -y && apt install curl -y && curl http://172.17.0.2:80"
docker container run \
--name ubuntu_not_linked \
--rm ubuntu:21.04 \
bash -c "apt update -y && apt install curl -y && curl http://localhost:80"
docker container run `
--name ubuntu_not_linked `
--rm ubuntu:21.04 `
bash -c "apt update -y && apt install curl -y && curl http://localhost:80"
docker network inspect bridge
docker container run \
--name webapp \
-p 8080:80 \
--network bridge \
-d nginx
docker container run `
--name webapp `
-p 8080:80 `
--network bridge `
-d nginx
docker container rm -f webapp centos7 postgresdb && \
docker network rm backend_bridge && \
docker volume prune -f
docker container rm -f webapp centos7 postgresdb `
| docker network rm backend_bridge `
| docker volume prune -f
docker container run --name webapp -p 8080:80 \
--network backend_bridge -d nginx \
&& \
docker container run --name postgresdb \
-e POSTGRES_PASSWORD=password -p 5432:5432 \
--network backend_bridge -d postgres:12.6 \
&& \
docker container run --name centos7 \
--network backend_bridge -dit centos:7 bash
docker container run --name webapp -p 8080:80 `
--network backend_bridge -d nginx `
| `
docker container run --name postgresdb -e POSTGRES_PASSWORD=password `
-p 5432:5432 --network backend_bridge -d postgres:12.6 `
| `
docker container run --name centos7 `
--network backend_bridge -dit centos:7 bash
docker network create backend_bridge \
--driver bridge
docker network create backend_bridge `
--driver bridge
docker network inspect bridge host none
docker container run `
--name disable-net `
--network none `
-dit centos:7 bash
docker network create -d bridge prod \
--subnet=10.10.0.0/16 \
--ip-range=10.10.1.0/24 \
--gateway=10.10.1.254
docker network create -d bridge prod `
--subnet=10.10.0.0/16 `
--ip-range=10.10.1.0/24 `
--gateway=10.10.1.254
docker container rm -f $(docker container ls -aq) && \
docker volume prune -f && \
docker network prune -f
docker container rm -f $(docker container ls -aq) | `
docker volume prune -f | `
docker network prune -f
docker run -dit \
--name prod_bash2 \
--network prod \
--ip 10.10.1.50 centos:7
docker run -dit `
--name prod_bash2 `
--network prod `
--ip 10.10.1.50 centos:7
docker run --name prod_bash --network prod -dit centos:7 bash && \
docker run --name prod_webapp --network prod -d nginx
docker run --name prod_bash --network prod -dit centos:7 bash | `
docker run --name prod_webapp --network prod -d nginx
docker run --network dev --name dev_webapp -d httpd && \
docker run --network dev --name dev_bash -dit centos:7 bash && \
docker run --network sandbox --name sandbox_webapp -d httpd && \
docker run --network sandbox --name sandbox_bash -dit centos:7 bash
docker run --network dev --name dev_webapp -d httpd | `
docker run --network dev --name dev_bash -dit centos:7 bash | `
docker run --network sandbox --name sandbox_webapp -d httpd | `
docker run --network sandbox --name sandbox_bash -dit centos:7 bash
docker network create -d bridge sanbox && \
docker network create -d bridge dev
docker network create -d bridge sandbox | `
docker network create -d bridge dev
docker container rm -f $(docker container ls -aq) && \
docker volume prune -f && \
docker network prune -f
docker run --network host --name webapp -d nginx
docker container rm -f $(docker container ls -f 'network=none' -aq) && \
docker volume prune -f
docker container rm -f $(docker container ls -f 'network=none' -aq) | `
docker volume prune -f
docker container run \
--name disable-net \
--network none \
-dit centos:7 bash
docker container rm -f postgresdb-with-exist-volume webapp postgresdb && \
docker volume prune -f
docker container rm -f postgresdb-with-exist-volume webapp postgresdb | `
docker volume prune -f
docker container run \
--name postgresdb \
-e POSTGRES_PASSWORD=password \
-d postgres:12.6 && \
docker container run \
--name webapp \
-p 80:80 \
-d nginx && \
docker container run \
-e MYSQL_ROOT_PASSWORD=password \
--name mysqldb \
-d mysql:5.7
docker container run `
--name postgresdb `
-e POSTGRES_PASSWORD=password `
-d postgres:12.6 | `
docker container run `
--name webapp `
-p 80:80 `
-d nginx | `
docker container run `
-e MYSQL_ROOT_PASSWORD=password `
--name mysqldb `
-d mysql:5.7
docker container run \
--name postgresdb-with-volume \
-v pgdata_volume:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=password \
-d postgres:12.6
docker container run `
--name postgresdb-with-volume `
-v pgdata_volume:/var/lib/postgresql/data `
-e POSTGRES_PASSWORD=password `
-d postgres:12.6
docker volume create \
-d local \
--label app=database \
pgdata_volume
docker volume create `
-d local `
--label app=database `
pgdata_volume
docker volume inspect pgdata_volume
docker container run \
--name webapp_readonly \
--mount type=bind,source="$(pwd)"/html,destination=/var/www/html,readonly \
--mount type=bind,source="$(pwd)"/conf/default.conf,destination=/etc/nginx/conf.d/default.conf \
-p 9080:80 \
-d nginx
docker container run `
--name webapp_readonly `
--mount type=bind,source="$(pwd)"\html,destination=/var/www/html,readonly `
--mount type=bind,source="$(pwd)"\conf\default.conf,destination=/etc/nginx/conf.d/default.conf `
-p 9080:80 `
-d nginx
docker container run \
--name webapp_public \
--mount type=bind,source="$(pwd)"/html,destination=/var/www/html \
--mount type=bind,source="$(pwd)"/conf/default.conf,destination=/etc/nginx/conf.d/default.conf \
-p 9090:80 \
-d nginx
docker container run `
--name webapp_public `
--mount type=bind,source="$(pwd)"\html,destination=/var/www/html `
--mount type=bind,source="$(pwd)"\conf\default.conf,destination=/etc/nginx/conf.d/default.conf `
-p 9090:80 `
-d nginx
docker container run \
--name webapp \
-p 8080:80 \
-v "$(pwd)"/html:/usr/share/nginx/html \
-d nginx
docker container rm -f webapp webapp_public webapp_readonly
server {
listen 80;
listen [::]:80;
server_name localhost;
#charset koi8-r;
access_log /var/log/nginx/host.access.log main;
location / {
root /var/www/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Belajar HTML</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<nav class="blue">
<div class="nav-wrapper container">
<a href="#" class="brand-logo">Belajar HTML</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="sass.html">HTML</a></li>
<li><a href="badges.html">CSS</a></li>
<li><a href="collapsible.html">JavaScript</a></li>
</ul>
</div>
</nav>
<div>
<div class="row">
<div class="col s12 m6">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<span class="card-title">HTML</span>
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div class="card-action">
<a href="#">This is a link</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m6">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<span class="card-title">JavaScript</span>
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div class="card-action">
<a href="#">This is a link</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m6">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<span class="card-title">CSS</span>
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div class="card-action">
<a href="#">This is a link</a>
</div>
</div>
</div>
</div>
</div>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>
docker container rm -f webapp webapp2 local_webapp local_webapp2 local_mount_nginx local_mount_httpd && \
docker volume prune -f
docker container rm -f webapp webapp2 local_webapp local_webapp2 local_mount_nginx local_mount_httpd | `
docker volume prune -f
ServerRoot "/usr/local/apache2"
Listen 80
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
<IfModule !mpm_prefork_module>
#LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
#LoadModule cgi_module modules/mod_cgi.so
</IfModule>
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>
ServerAdmin you@example.com
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog /proc/self/fd/2
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog /proc/self/fd/1 common
</IfModule>
<IfModule headers_module>
RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>
docker container run \
--label env=local \
--label type=bind \
--name local_mount_nginx \
--mount type=bind,source="$(pwd)"/html,destination=/var/www/html \
--mount type=bind,source="$(pwd)"/conf/default.conf,destination=/etc/nginx/conf.d/default.conf \
-p 9090:80 -d nginx && \
docker container run \
--label env=local \
--label type=bind \
--name local_mount_httpd \
--mount type=bind,source="$(pwd)"/html,destination=/var/www/html \
--mount type=bind,source="$(pwd)"/conf/httpd.conf,destination=/usr/local/apache2/conf/httpd.conf \
-p 9091:80 -d httpd
docker container run `
--label env=local `
--label type=bind `
--name local_mount_nginx `
--mount type=bind,source="$(pwd)"\html,destination=/var/www/html `
--mount type=bind,source="$(pwd)"\conf\default.conf,destination=/etc/nginx/conf.d/default.conf `
-p 9090:80 -d nginx | `
docker container run `
--label env=local `
--label type=bind `
--name local_mount_httpd `
--mount type=bind,source="$(pwd)"\html,destination=/var/www/html `
--mount type=bind,source="$(pwd)"\conf\httpd.conf,destination=/usr/local/apache2/conf/httpd.conf `
-p 9091:80 -d httpd
docker volume create -d local public_html && \
docker run --label env=local --name local_webapp -p 8080:80 -v public_html:/usr/share/nginx/html -d nginx && \
docker run --label env=local --name local_webapp2 -p 8081:80 -v public_html:/usr/share/nginx/html -d nginx
docker volume create -d local public_html | `
docker run --label env=local --name local_webapp -p 8080:80 -v public_html:/usr/share/nginx/html -d nginx | `
docker run --label env=local --name local_webapp2 -p 8081:80 -v public_html:/usr/share/nginx/html -d nginx
docker volume create --driver vieux/sshfs \
-o sshcmd=test@192.168.88.100:/home/test \
-o port=22 \
-o password=testing \
sshvolume
ssh-keygen -t ed25519 -C "your_email@example.com" && \
eval "$(ssh-agent -s)" && \
ssh-add ~/.ssh/id_ed25519 && \
ssh-copy-id dimasm93@192.168.88.100
docker plugin install --grant-all-permissions vieux/sshfs DEBUG=1
docker run --rm -it -u root --workdir /root \
--mount type=volume,volume-driver=vieux/sshfs,src=sshvolume,target=/root \
alpine ash
docker build -t simple-web .
docker container rm -f webapp && \
docker volume prune -f && \
docker image rm -f simple-web
docker container rm -f webapp | `
docker volume prune -f | `
docker image rm -f simple-web
docker run --name webapp -p 80:80 -d simple-web
FROM nginx
COPY index.html /usr/share/nginx/html/index.html
EXPOSE 80
docker image rm -f $(docker images dimmaryanto93/centos -q)
FROM centos:7
ENV HTML=/usr/share/nginx/html
ADD *.tar.gz ${HTML}
ENTRYPOINT ["du", "-h", "--total", "/usr/share/nginx/html/"]
*.md
!README.md
## Mac OS
.DS_Store
## Jetbraint
.idea/
*.iml
*.ipl
## maven
target/*
!target/*.jar
FROM centos:7
ENV HTML=/usr/share/nginx/html
RUN mkdir -p ${HTML} && \
echo "<html><head><title>Halo World</title></head><body><h3>it's Works!</h3></body></html>" > ${HTML}/index.html
ENTRYPOINT ["cat", "/usr/share/nginx/html/index.html"]
FROM centos:7
RUN echo "halo semuanya, ini adalah contoh text" > /var/halo.txt
ENTRYPOINT [ "cat", "/var/halo.txt" ]
FROM centos:7
ENV HTML=/usr/share/nginx/html
RUN mkdir -p ${HTML}
ADD . ${HTML}
ENTRYPOINT ["ls", "/usr/share/nginx/html/"]
ARG IMAGE_VERSION=7
FROM centos:$IMAGE_VERSION
ENV HTML=/usr/share/nginx/html
RUN mkdir -p ${HTML} && \
echo "<html><head><title>Halo World</title></head><body><h3>it's Works!</h3></body></html>" > ${HTML}/index.html
ENTRYPOINT ["cat", "/usr/share/nginx/html/index.html"]
FROM centos:7
LABEL maintaniner="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.image.authors="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.vendor="PT. Tabeldata Informatika"
LABEL version="0.5"
ENV HTML=/usr/share/nginx/html
RUN mkdir -p ${HTML}
ADD . ${HTML}
ENTRYPOINT ["ls", "/usr/share/nginx/html/"]
docker container rm -f postgresdb && \
docker network rm postgres_net && \
docker volume prune -f && \
docker image rm -f $(docker images dimmaryanto93/centos -q)
docker container rm -f postgresdb | `
docker network rm postgres_net | `
docker volume prune -f | `
docker image rm -f $(docker images dimmaryanto93/centos -q)
FROM centos:7
ENV POSTGRES_HOST=postgresdb
ENV POSTGRES_USER=postgres
LABEL maintaniner="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.image.authors="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.vendor="PT. Tabeldata Informatika"
LABEL version="0.7"
RUN yum install postgresql -y
CMD ["bash", "-c", "psql -h ${POSTGRES_HOST} -U ${POSTGRES_USER} -W"]
FROM centos:7
LABEL maintaniner="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.image.authors="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.vendor="PT. Tabeldata Informatika"
LABEL version="0.8"
RUN yum install postgresql -y
ENTRYPOINT ["psql"]
FROM centos:7
LABEL maintaniner="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.image.authors="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.vendor="PT. Tabeldata Informatika"
LABEL version="0.6"
RUN yum install postgresql -y
docker container rm -f postgresdb webapp && \
docker volume prune -f && \
docker network rm local_net && \
docker image rm -f $(docker images dimmaryanto93/centos -q)
docker container rm -f postgresdb webapp | `
docker volume prune -f | `
docker network rm local_net | `
docker image rm -f $(docker images dimmaryanto93/centos -q)
FROM centos:7
ENV POSTGRES_USER=postgres
ARG POSTGRES_HOST=postgresdb LABEL maintaniner="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.image.authors="software.dimas_m@icloud.com"
LABEL com.maryanto.dimas.vendor="PT. Tabeldata Informatika"
LABEL version="0.9"
RUN yum install postgresql -y ENTRYPOINT ["psql"]
ENTRYPOINT ["psql"]
CMD ["--help"]
FROM centos:7
ENV POSTGRES_USER=postgres
ARG POSTGRES_HOST=postgresdb
LABEL maintaniner="software.dimas_m@icloud.com"