$ docker pull <image_name>
$ docker run <image_name>
+
=
The same environment, wherever you run it
Docker shares and reuses a lot of resources
If there is an image for the service, all you have to do is download and run it.
Docker allows you to package an application with all of its dependencies into a standardized unit for software development.
https://www.docker.com/what-docker
Debian + PostgreSQL
IMAGES
(aka "standardized unit for software development")
CONTAINERS
Debian + PostgreSQL
Running the Postgresql
Debian + PostgreSQL
Running the Postgresql
$ docker pull postgres
$ docker run --name db postgres
$ docker run -it --link db postgres \
sh -c 'psql -h $DB_PORT_5432_TCP_ADDR -U postgres'
$ docker ps
CONTAINER ID IMAGE [...] STATUS PORTS NAMES
f34bd9bf7083 postgres [...] Up 2 minutes 5432/tcp angry_turing
c12b2e87c42b postgres [...] Up 2 minutes 5432/tcp db
Note: To list stopped containers, use the -a option
FROM <base_image>
RUN apt-get install <some dependencies>
...
$ docker build -t my_image_name .
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
my_image_name latest 227510c3fed6 1 minute ago XYZ.X MB
Compose is a tool for defining and running multi-container Docker applications.
https://docs.docker.com/compose
db:
image: postgres
web:
build: .
ports:
- "3000:3000"
volumes:
- .:/code
links:
- db
$ docker-compose up