Skip to content

Instantly share code, notes, and snippets.

@hazelement
Last active February 21, 2019 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazelement/1c7dbbc12caa7708dc36787ebd09f1ca to your computer and use it in GitHub Desktop.
Save hazelement/1c7dbbc12caa7708dc36787ebd09f1ca to your computer and use it in GitHub Desktop.
Docker example
# /etc/docker/daemon.json
{
"data-root": "/home/docker/docker_cache",
"insecure-registries":["192.168.59.10:5500"]
}
## Steps to install docker on brand new machine
1. Install docker and docker-compose
* `apt-get install docker docker-compose`
* `yum install docker docker-compose`
2. Add certain user to docker group, `usermod -aG docker $USER`
3. Direct docker to save cache to a specific location, modify `daemon.json` following the `daemon.json` notes.
4. If SElinux is enabled, issue this command to allow docker to access sepecified location `chcon -R -t svirt_sandbox_file_t /SOURCEDIR`
version: "3"
services:
proxy:
build: ./proxy
networks:
- frontend
db:
image: postgres
networks:
- backend
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
networks:
- frontend
- backend
networks:
frontend:
# Use a custom driver
driver: custom-driver-1
backend:
# Use a custom driver which takes special options
driver: custom-driver-2
driver_opts:
foo: "1"
bar: "2"
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment