# Lab 7: Proxy server and Production Ready

Hi guys, This lab we would learn about Proxy Server for your mini-microservice app(s) and how to make our Image and Container to be Production Ready.

To make our container(s) is production ready, we want it to be stateless as possible. Therefore, we would remove the volume(s).

# Workshops

# Nginx Reverse Proxy Server

# Traefik Reverse Proxy Server

# Lab 7 (Continue): Docker context (opens new window)

  • Docker context make it easy for a single Docker CLI to manage multiple Swarm clusters, multiple Kubernetes clusters, and multiple individual Docker nodes.
  • To make it short, Docker context allows you to manipulate the Docker Node remotely. Therefore, you can use this method to deploy your container (app) easier.

# 1. Make sure you can SSH to remote machine

...
Host lab-sad-ssh
  HostName XXX.XXX.XXX.XXX (or hostname)
  User {username}
  IdentityFile {path of private key}
...
1
2
3
4
5
6

# 2. Create the context

docker context create lab-sad-context --docker host=ssh://lab-sad-ssh
1
docker context ls
1

output

NAME                                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                KUBERNETES ENDPOINT   ORCHESTRATOR
default *                           moby                Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine                                       swarm
lab-sad-context                     moby                                                          ssh://lab-sad-ssh
1
2
3

# 3. Switch Context

docker context use lab-sad-context
1
docker context ls
1

output

NAME                                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                KUBERNETES ENDPOINT   ORCHESTRATOR
default                             moby                Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine                                       swarm
lab-sad-context *                   moby                                                          ssh://lab-sad-ssh
1
2
3

# 4. Compose up

docker-compose -f ./docker-compose-prod.yml up --build -d
1