Skip to content

Instantly share code, notes, and snippets.

@natalie-o-perret
Last active April 22, 2019 18:16
Show Gist options
  • Save natalie-o-perret/e9e342a169dab4377051c24d7460ed7a to your computer and use it in GitHub Desktop.
Save natalie-o-perret/e9e342a169dab4377051c24d7460ed7a to your computer and use it in GitHub Desktop.
Docker + Kubernetes Notes

Docker

Some definitions

  • Layer: Files generated from running some command, also called intermediate images. Reused by multiple images to reduce image and size.
  • Image: A docker container image is created using a dockerfile (ie. build). Every line in a dockerfile will create a layer.
  • Container: an instance of an (read-only) image.
  • Docker Client: the CLI tool that allows the user to interact with the Docker Server.
  • Docker Server: aka Docker Daemon, the background service running on the host that manages the building, running and distributing Docker containers.

Simplest Dockerfile Ever!

# Use an existing image as a base
FROM alpine

# Download and install a dependency
RUN apk add --update redis

# Tell an image what to do when it starts as a container
CMD ["redis-server"]

Then build its image: docker build .

And run it: docker run -p 8080:8080 id-given-upon-build-completion

docker-compose

Simple Example:

version: '3'
services:
  redis-server:
    image: 'redis'
  node-app:
    restart: on-failure
    build: .
    ports:
      - "4001:8081"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment