Question: Nautilus DevOps team is testing some applications deployment on some of the application servers. They need to deploy a nginx container on Application Server 1. Please complete the task as per details given below:
On Application Server 1 create a container named nginx_1 using image nginx with alpine tag and make sure container is in running state.
Please Note:- Perform the below commands based on your question server, user name & other details that might differ. So please read the task carefully before executing it. All the Best 👍
Solution:
1. At first login on app server as per the task & switch to root user
thor@jump_host
~$ ssh tony@stapp01 The authenticity
of host 'stapp01 (172.16.238.10)' can't be established. ECDSA key
fingerprint is SHA256:+GEXixL2LtA06sRZ5OqTHyuSpltvLhCR6X5gmrNY3xs. ECDSA key
fingerprint is MD5:84:02:c0:6a:91:18:66:7b:d2:be:97:a3:c0:70:0e:10. Are you sure you
want to continue connecting (yes/no)? yes Warning:
Permanently added 'stapp01,172.16.238.10' (ECDSA) to the list of known hosts. tony@stapp01's
password: [tony@stapp01
~]$ sudo su - We trust you
have received the usual lecture from the local System Administrator.
It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great
responsibility. [sudo] password
for tony: [root@stapp01
~]# |
2. Run the Below command to check the existing docker Images & container running
[root@stapp01
~]# docker ps CONTAINER
ID IMAGE COMMAND
CREATED STATUS PORTS
NAMES [root@stapp01
~]# [root@stapp01
~]# docker images REPOSITORY TAG
IMAGE ID CREATED SIZE [root@stapp01
~]# |
[root@stapp01
~]# docker run -d --name nginx_1 -p 8080:80 nginx:alpine Unable to find
image 'nginx:alpine' locally alpine: Pulling
from library/nginx 5843afab3874:
Pull complete 0dc18a5274f2:
Pull complete 48a0ee941dcd:
Pull complete 2446243a1a3f:
Pull complete cbf0756b41fb:
Pull complete c72750a979b9:
Pull complete Digest: sha256:ad14f3471c0fd650022d3d2ff370e02c51113679070486e510dfcbe64d00565a Status:
Downloaded newer image for nginx:alpine aca9494a332195d08990a755fd3a7b335c9daaad9a1dac10e08789624ee857c7 [root@stapp01
~]# |
[root@stapp01
~]# docker ps CONTAINER
ID IMAGE COMMAND CREATED STATUS PORTS NAMES aca9494a3321 nginx:alpine "/docker-entrypoint.…" 11 seconds ago Up 8 seconds 0.0.0.0:8080->80/tcp nginx_1 [root@stapp01
~]# [root@stapp01
~]# docker images REPOSITORY TAG
IMAGE ID CREATED SIZE nginx alpine b9e2356ea1be 3 weeks ago 22.8MB [root@stapp01
~]# |
[root@stapp01
~]# curl http://localhost:8080 <!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> [root@stapp01
~]# |
Happy Learning!!!!
0 Comments