a) Install docker on an Ubuntu GCP instance
b) Use docker pull to download docker images on this server
c) Use docker run to run nginx container using this image. Use below parameters for the container
-
i. Name: mynginx
-
ii. Host port: 80
-
iii. Container port: 80
-
iv. Should run in detach mode
d) Login to mynginx container and check the nginx process running or not. Ideally it should be running
e) Check if nginx is accessible on http://<Server_Pubilc_IP>:80 and you see below page:
a) Create a Dockerfile to package below:
-
i. uses ubuntu docker image
-
ii. Install apache2 inside it
-
iii. Mount any local html file from host to /var/www/html path of container
-
iv. Uses command as entrypoint:
ENTRYPOINT apachectl -D FOREGROUND
b) Create a sample html file with some content in the same directory as dockerfile
c) Once above Dockerfile is ready, perform below tasks:
-
i. Build the dockerfile with name ubuntu_apache
-
ii. Spawn a new container using below params:
- Name: ' myapache'
- Host port: 81
- Container port: 80
- Should run in detach mode
-
iii. Check if apache is accessible on http://<Server_Pubilc_IP>:81 and you see the content of html file you created in step 'b'.