Docker stuff

docker build -t friendlyello –tag=friendlyhello .

docker run -d -p 4000:80 friendlyello

docker stop 1bd7ed055412

docker exec -it 1bd7ed055412 /bin/bash

docker ps

docker info

docker image ls

$ docker run –name andrew1 -d -p 4000:80 bae2beae2108 d37e2100cbf0fc61b9cd21ceb0734e19b501c3888fa4bb1411f99a5c2d6beb0a

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
d37e2100cbf0        bae2beae2108        "python app.py"     4 seconds ago       Up 3 seconds        0.0.0.0:4000->80/tcp   andrew1
$

Start and stop containers, background to daemon mode with -d.

$ docker-compose up -d
Recreating 2ndtest_redis_1 ... done
Recreating 2ndtest_web_1   ... done
$ 
$ docker-compose down
Stopping 2ndtest_web_1   ... done
Stopping 2ndtest_redis_1 ... done
Removing 2ndtest_web_1   ... done
Removing 2ndtest_redis_1 ... done
Removing network 2ndtest_default
$ 
docker-compose.yml

version: '3'

services:
  web:
    build: .
    image: flask_web
    ports:
     - "5000:5000"
    links:
      - redis
    networks:
      - flask_app
    environment:
      - REDIS_URL=redis://cache
    restart: unless-stopped

  redis:
    image: "redis:alpine"
    container_name: cache
    networks:
      - flask_app
    restart: unless-stopped

networks:
  flask_app:
    driver: bridge

rb/docker-cheatsheet.txt · Last modified: 30/01/2019 10:03 by andrew