loading...

Must try Docker feature

padakipavan profile image padaki-pavan ・1 min read

Working on docker can be time and disk consuming process. I discovered this feature recently, I feel like its really underrated.

Remote host via ssh

export DOCKER_HOST=ssh://user@123.432.543.234

setting this DOCKER_HOST flag will use your remote machine where docker is installed as the default host.

My workflow

I stored the above flag in my shell profile (zsh) and whenever I want to push some code, I update my docker-compose file and simply run respective build and start command and everything is pushed to my remote host automatically and securely using ssh, and without running a single container on my local machine. There's no need for me to have complex github actions and heroku setups etc. It just works!

Its been a real life saver for me, hope someone out there will find it useful as-well.

Discussion

pic
Editor guide
 

You can also try running the docker daemon remotely on tcp and then access in similar manner

 

Yes, that's was the only way to do it until recently ssh support was added. Which is more secure and one less port to expose.

 

This is a cool idea. As I spend time on heroku and push it for dev purpose and sometimes pipelines fail I do push from local. But this is an awesome feature. Thanks for sharing.