Undefined Title

Build envconsul on Docker container

2014-06-29

envconsul seems we cannot download its built binary file and need to build by ourselves. Ideally it’s hopeful to use go get but it needs to golang environment. When I wanna use envconsul on a CentOS host but only there is MacOSX having golang, yeah, you can use Vagrant or Docker.

So I wrote a Dockerfile.

It’s very simple to install golang and git with yum, and go get and build. Thankfully it never change host OS.

CMD ["cp", "envconsul", "/target"]

This CMD copies the built binary into /target, if you run as follow, the binary comes into /tmp of the host OS file system.

docker build -t envconsul.build .
docker run -v /tmp:/target envconsul.build

Then you transfer it to the CentOS.

In MacOSX, probably you use boot2docker, copy it with scp.

$ boot2docker config | egrep 'SSHPort|SSHKey'
SSHKey = "/Users/<yourname>/.ssh/id_boot2docker"
SSHPort = 2022
$ scp -P 2022 -i ~/.ssh/id_boot2docker docker@localhost:/tmp/envconsul
envconsul                                100% 8304KB   8.1MB/s   00:01

[To the original]