In some cases, you may want to run the Docker build using the extra resources.
Instead of hogging the laptop RAM and CPU while it is building the docker images.

With docker machine, you are now able to do it pretty much quickly.

 

Here are the step:

 

  1. Install and run VPN server on the remote machine (optional)
  2. Install and run the docker daemon in the remote machine
  3. Connect to its port using VPN port (allow firewall setting to the VPN server port)
    1. Otherwise, you will have to open the docker port itself and expose on public IP before can connect it
  4. Add docker context with the remote docker machine, and set to use this context
  5. Run docker build and the rest of the build command using the context
  6. Run docker-compose using context to test
  7. Run SSH port forward to local port to access the serving port

 

That’s it!