https://slides.com/coreybrooks/intro-to-docker
Software Engineer @OnDeck-AI
Previously @GitHub, @Gitalytics, @Foodee
Virtual Machines | Containers |
---|---|
Separate kernel for each VM | One kernel manages containers |
Source: https://www.smarthomebeginner.com/what-is-docker-docker-vs-virtualbox/
Virtual Machines | Containers |
---|---|
"House" | "Apartment Suite" |
https://docs.docker.com/engine/reference/commandline/cli/
Commands:
build Build an image from a Dockerfile
commit Create a new image from a container's changes
exec Run a command in a running container
images List images
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rm Remove one or more containers
run Run a command in a new container
help Show usage
docker network create my_net
docker run -d --network=my_net nginx
docker network create my_net
docker run -d --network=my_net nginx
👎
TRAFFIC
LB
SERVER1
DB
"INTERNET"
DOCKER NETWORK
SERVER2
TRAFFIC
FRONTEND
NETWORK
INTERNET
LB
DB
BACKEND NETWORK
SERVER2
SERVER1
# .dockerignore
# editor stuff
.idea/
.vscode/
.subl/
# dependencies
node_modules/
vendor/
# anything else...
Dockerfile
docker-compose.yaml
.dockerignore
Ignores everything for ADD/COPY steps
This will limit cache busting
FROM node:boron-jessie
ENV NODE_ENV=dev
WORKDIR /usr/app
ADD . /usr/app
RUN \
npm install
CMD ["node", "app.js"]
FROM node:boron-jessie
ENV NODE_ENV=dev
WORKDIR /usr/app
ADD package.json /usr/app/package.json
RUN \
npm install
ADD . /usr/app
CMD ["node", "app.js"]
BAD
GOOD