Public | Automated Build

Last pushed: a year ago
Short Description
Go Language Development and Learning Environment/Container
Full Description

Go Language Development and Learning Environment

This is a docker container to learn and develop in Go language without the need to install Go in your computer. It can also be used - eventually - to dockerize your Go application.

How to use?

To login to the container and start using Go, just execute make run. The image will be pulled (if not done before) and run the container. After that you will see the container prompt.

$ make run
Running the container godevenv
root@8dac5ea8da15:~/workspace#

For more options continue reading or execute make help.

Another terminal and execute commands

To have a second, third, or Nth terminal, execute make run again. The make run is used to start up the container for the first time but if used again in other terminal will login to the container. This is useful to have a console when a process is running in the container.

make run
Login to the existing container godevenv
root@92f064f5cf3f:~/workspace# tail -f /tmp/output

Sometimes there is no need to login into the container to execute a command. That can be done with make exec and the command(s) to execute.

make exec tail /tmp/output

However, if the command's parameters use dashes (- or --), redirects (< or >), etc... then quote them.

# Assuming there is a container running a process:
make exec 'tail -f /tmp/output | grep ERROR'

Build and Push

Execute make to build the image and keep it in locally.

make

To push the image to DockerHub use the push parameter:

make push

But, if you want to build and push it to DockerHub, it is better to use the release parameter:

make release

And, there is also make all which is going to build, push and finally run.

make all

Cleanup

The container will be deleted after you exit from it. If not, list the running containers and remove it.

docker ps -a
docker rm <id>

To remove the image:

make clean

Customize

Modify the DockerHub account and image or repository name in the Makefile file:

USERNAME = johandry
IMG_NAME = godevenv

Also the volumes to share, the working directory, any environment variable you want to set in the container and any port to map between the localhost and the container.

VOLUMES = -v "${PWD}/workspace":/root/workspace
WORKDIR = -w /root/workspace
ENV     = -e SOME_KEY=SOME_VALUE OTHER_KEY=OTHER_VALUE
PORTS   = -p 8080:80

If you need more packages in the container, modify the PACKAGES environment variable in the Dockerfile.

ENV PACKAGES 'vim less lynx links'

It is possible to modify the user profile editing the .bashrc file. A modification to this file or to the Dockerfile will require re-building the image.

Docker Pull Command
Owner
johandry
Source Repository

Comments (0)