Docker containers allow you to define a VM-like environment specified by a series of steps in a Docker configuration file (
Dockerfile), and then run your environment on various host platforms (e.g. Linux, Mac, Windows, Chrome OS). We use Docker containers to run our Development Environment, as well as to run binaries on the Google Cloud platform.
After installation you can verify Docker works by running the following from the command line / terminal:
$ docker run hello-world
Build the environment specified by
docker/Dockerfile, tagging the result with
my_image, with the current directory as the source:
$ docker build -f docker/Dockerfile -t my_image .
Run the latest variant of
my_image, removing the container after it stops, mapping port 8080 locally to port 8080 in the container, naming the created container
$ docker run --rm -p 8080:8080 --name my_run my_image:latest
Stop the container named
$ docker container stop my_run