Skip to content

Instantly share code, notes, and snippets.

@Xantios
Last active April 27, 2022 09:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xantios/1414e2afd9b6c9c959ce1227ea175b03 to your computer and use it in GitHub Desktop.
Save Xantios/1414e2afd9b6c9c959ce1227ea175b03 to your computer and use it in GitHub Desktop.

Why?

Long story short? My Macbook Pro 2016 is a pain in the bum It seems to be kicking the bucket soon

Also; Running your own weird "cloud" is just cool!

Docker server

Just make sure you are running dockerd (docker ps should give you a hint) Also make sure you have ssh-key auth set up propperly.

you do NOT need to expose the host if you have a fairly recent version of docker

Client

Now you could use the 'good old' docker-machine command to get this show on the road, which still is a great tool. However needlessly complex for my usecase

DOCKER_HOST=ssh://xantios@10.13.37.2 docker ps

Really works pretty well, just set a variable known to the regular docker-client and ask it to run the ps command if you have any issues running this, make sure you can connect to the server you are targeting and make sure you have your keys setup propperly

Now for the gist of this gist

Run something like this to tell your current shell where our docker server lives

export DOCKER_HOST=ssh://xantios@10.13.37.2

now run any docker command, and it wil run remotely :-) docker-compose runs docker commands in a chain, so that should work to. but if you run into the connection limit of your server you might need to increase the max sessions in your SSH deamon, see: docker/compose#6463

just plop that export line into your shell config (eg: ~./.zshrc) and call it a day if you want to go the extra 1,609344 kilometer (thats a mile, converted to a non idiotic conveluated unit of measurement ) wrap a bash script arround it to set multiple servers

Feel free to message me if you happen to have written such a thing and maybe i'll add it to this post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment