Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Subjek Dokumen Network Development Operations (Modul C)

Subjek Pembahasan IT Network Systems Administration


Pensyusun / Tanggal MGMP TKJ Depok / 11 Juli 2021

NetDevOps

No Question Answer

root@debian:~#nano /etc/network/interfaces

allow-hotplug enp0s3
iface enp0s3 inet dhcp

1 IP Address

root@debian:~#nano /etc/apt/sources.list

deb http://deb.debian.org/debian buster maindeb-src http://deb.debia


n.org/debian buster maindeb http://deb.debian.org/debian-security/ b
uster/updates maindeb-src http://deb.debian.org/debian-security/ bus
ter/updates maindeb http://deb.debian.org/debian buster-updates mai
ndeb-src http://deb.debian.org/debian buster-updates main
2 Repository Debian 10

3 Update System Debian root@debian:~#apt-get update


Creater File install-docke
4 root@debian:~#touch install-docker.sh
r.sh
root@debian:~#nano install-docker.sh

apt-get update
apt-get install apt-transport-https ca-certificates
curl gnupg2 software-properties-common -y
curl -fsSL https://download.docker.com/linux/debian
/gpg | apt-key add -
5 Edit File install-docker.sh
add-apt-repository "deb [arch=amd64] https://downlo
ad.docker.com/linux/debian $(lsb_release -cs) stabl
e"
apt-get update
apt-cache policy docker-ce
apt-get install docker-ce -y

6 View File install-docker.sh root@debian:~#ls


7 Change access rights root@debian:~#chmod +x install-docker.sh
root@debian:~#./install-docker.sh

8 Install-docker.sh

9 Create Folder myweb root@debian:~#mkdir myweb


10 Go to myweb folder root@debian:~#cd myweb
Create a main.py file in th
11 root@debian:~/myweb#touch main.py
e myweb folder
View File main.py in the my
12 root@debian:~/myweb#ls
web folder
root@debian:~/myweb#nano main.py

from flask import Flask, request, render_template


sample = Flask(__name__)
13 Edit File main.py @sample.route("/")
def main():
return render_template("index.html")
if __name__ == "__main__":
sample.run(host="0.0.0.0", port=8080)
root@debian:~/myweb#nano index.html

<html>
<head>
<title>Sample app</title>
</head>
<body>
<h1>You are calling me from {{request.remote_addr}}</h1>
</body>
</html>
14 Edit File index.html

Create a templates folder i


15 root@debian:~/myweb#mkdir templates
n the myweb folder folder
Move the index.html file to
16 root@debian:~/myweb#mv index.html templates/
the templates folder
root@debian:~#docker -v

17 View versi docker

root@debian:~# docker images

18 View docker images

root@debian:~# docker pull debian:latest


Drag debian to docker regis
19
try

20 Create Image Custom root@debian:~/myweb#touch Dockerfile


21 Edit Dockerfile root@debian:~/myweb#nano Dockerfile
FROM debian:latest
MAINTAINER mgmp tkj depok “mgmptkjdepok@gmail.com”
RUN apt-get update
RUN apt-get install -y python3 python3-pip
RUN pip3 install flask
COPY . /myweb
WORKDIR /myweb
EXPOSE 8080
CMD [“python3”,”main.py”]
root@debian:~/myweb#docker build -t myimages/myweb
.

22 Build docker to images

root@debian:~#docker run -d --name myweb myimages/m


23 Running docker
yweb
root@debian:~/myweb#docker ps

24 View running docker

root@debian:~/myweb#docker inspect myweb

25 Check docker python3

26 Check IP Adress root@debian:~/myweb#ping 172.17.0.2

172.17.0.2:8080

27 Check using a web browser

root@debian:~/myweb#docker exec -it myweb bash

28 Go to container docker

You might also like