Skip to content

Instantly share code, notes, and snippets.

@johnoscott
Last active March 31, 2018 08:32
Show Gist options
  • Save johnoscott/d9a5ddbd136fbd39415fcc00a1e63b3f to your computer and use it in GitHub Desktop.
Save johnoscott/d9a5ddbd136fbd39415fcc00a1e63b3f to your computer and use it in GitHub Desktop.
[Docker HowtTo] How to create a Docker container #docker #howto

Docker Container

Command Cheat Sheet

Markdown Less Pretty
Intention command Comment
Delete an image docker image rmi react:app images can take a lot of space (e.g. 1GB for node)
1 2 3

Terminology

  • Image described by a DockerFile that
  • build an image from DockerFile $ docker ...
  • Container is a Run an image with docker run
[ DockerFile ] --- build ---> ( Image ) --- run ---> [ Container ]

Learn Docker in 12 Minutes 🐳

https://www.youtube.com/watch?v=YFl2mCHdv24 Learn Docker in 12 Minutes

Try building a simple Docker image

Docker Compose How-To

Creates a virtual network for all the containers

Compose

docker-compose.yaml

version: '3'

services:
  product-service:
    build: ./product
    volumes:
      - ./product:/usr/src/app
    ports:
      - 5001:80
      
  website:
    image: php:apache
    volumes:
      - ./website:/var/www/html
    ports:
      - 5000:80
    depends_on:
      - products: 
      

Compose and Run

$ docker-compose up

$ docker-compose up -deep

What Containers are running ?

$docker ps

docker compose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment