Deploying Docker Git Containers Remotly
If I were to deploy a docker git containers and it’s requires no credential, I could use the following command
$ docker build -t example/image https://github.com/docker/rootfs.git
But what if it does require credentials and I wanted to use ssh public key authentication, the thing is the docker daemon might not have access to the private key used to log into ssh, but there is a solution one could use the git command to create the archive (or tallball) and then pass it to docker, for example.
$ git archive --format tar.gz --output /tmp/example.tar.gz --remote [email protected]:docker/rootfs.git master $ docker build -t example/image - < /tmp/example.tar.gz
If I wanted to deploy to a remote server, I could make use of scp (to copy) and ssh (to build), for example.
$ git archive --format tar.gz --output /tmp/example.tar.gz --remote [email protected]:docker/rootfs.git master $ scp /tmp/example.tar.gz [email protected]:/tmp/example.tar.gz $ ssh [email protected] "docker build -t example/image - < /tmp/example.tar.gz"
I don’t need to do port forward or do anything messy, like running ssh in the background, which I have to close when I’m done with it, I just rather not do it that way. Using port forwarding to upload a tarball, honestly, I find that clumsy. I prefer clean simple and elegant solutions to a complex problem.
On a different subject, in the past I made comment about NodeJs, I won’t be making anymore comment about it, because everything about it bores me, I just had enough and I will not elaborate.