by Brian DeRocher / @openbrian
2015 October 27
Docker is a container which developers build around their applications in order to ship them into operating environments such as the cloud.
https://www.docker.com/Daemon | Images | Containers | Hub |
See also: Kitematic
$ apt-get install docker
Pull pre-existing imags from the Hub
$ docker pull django
django
Build images from a Dockerfile
$ docker build -t noblis/grailsapp .
List your docker images
$ docker images
Start an independent container from an image
$ docker run -it -p 3000:80 -V /home/amr/app:/opt noblis/grailsapp
List the running and non-running containers
$ docker ps -a
Save container changes as a new image
$ docker commit CONTAINER_ID noblis/grailsapp:version3
Publish new images on the Docker Hub
$ apt-get push
Each docker container may EXPOSE ports. "Linking" will bridge the port from one container to a port on another. For example EXPOSE 5432 PostgreSQL database with tag db. On web container use
docker run --name web --link db:thedb noblis/webapp python app.py
Then web container has environment variables defiend THEDB_NAME, THEDB_HOST, THEDB_PORT. And in the web app configuration connect to tcp://$THEDB_HOST:$THEDB_PORT/$THEDB_NAME.
@openbrian