Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rb:docker-cheatsheet [09/01/2019 16:49]
andrew
rb:docker-cheatsheet [30/01/2019 10:03] (current)
andrew
Line 24: Line 24:
 d37e2100cbf0 ​       bae2beae2108 ​       "​python app.py" ​    4 seconds ago       Up 3 seconds ​       0.0.0.0:​4000->​80/​tcp ​  ​andrew1 d37e2100cbf0 ​       bae2beae2108 ​       "​python app.py" ​    4 seconds ago       Up 3 seconds ​       0.0.0.0:​4000->​80/​tcp ​  ​andrew1
 $ $
 +</​code>​
 +
 +
 +Start and stop containers, background to daemon mode with ''​-d''​.
 +<​code>​
 +$ 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
 +
 +</​code>​
 +
 +<​code>​
 +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
 </​code>​ </​code>​
  

rb/docker-cheatsheet.1547052552.txt.gz ยท Last modified: 09/01/2019 16:49 by andrew