Part 17: GCP: Docker: How to deploy a web server with a single command ?

What it feels like if you run a command and your webserver is live.

Lets see the usage of containers and cloud shell i.e. GCP.

1. Run below command in Cloud Shell.
Dont press Ctrl+C and keep it in running state.

saketalwar2@cloudshell:~$ docker run -p 8080:80 nginx:latest
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
a2abf6c4d29d: Pull complete
a9edb18cadd1: Pull complete
589b7251471a: Pull complete
186b1aaa4aa6: Pull complete
b4df32aa5a72: Pull complete
a0bcbecc962e: Pull complete
Digest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
Status: Downloaded newer image for nginx:latest
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/01/08 08:18:50 [notice] 1#1: using the "epoll" event method
2022/01/08 08:18:50 [notice] 1#1: nginx/1.21.5
2022/01/08 08:18:50 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2022/01/08 08:18:50 [notice] 1#1: OS: Linux 5.10.68+
2022/01/08 08:18:50 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/01/08 08:18:50 [notice] 1#1: start worker processes
2022/01/08 08:18:50 [notice] 1#1: start worker process 31
2022/01/08 08:18:50 [notice] 1#1: start worker process 32
2022/01/08 08:18:50 [notice] 1#1: start worker process 33
2022/01/08 08:18:50 [notice] 1#1: start worker process 34
172.18.0.1 - - [08/Jan/2022:08:19:24 +0000] "GET /?authuser=0 HTTP/1.1" 200 615 "https://ssh.cloud.google.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0" "-"
2022/01/08 08:19:25 [error] 32#32: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.18.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1:8080", referrer: "https://8080-d4d4eaeb-e3ec-489b-9bf3-01844b105f54.cs-asia-southeast1-ajrg.cloudshell.dev/?authuser=0"
172.18.0.1 - - [08/Jan/2022:08:19:25 +0000] "GET /favicon.ico HTTP/1.1" 404 153 "https://8080-d4d4eaeb-e3ec-489b-9bf3-01844b105f54.cs-asia-southeast1-ajrg.cloudshell.dev/?authuser=0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0" "-"

 

2. Now click on below icon.


 

3. Now when you click on this, you will see your webserver live and running.


Looks interesting that with a single click, we have deployed an application/webserver.

Just imagine if your application container image was ran, your application would be live.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments