Docker Compose Setup and Review:
Docker bundles your application into an image which is a standalone executable package. Docker executes the image inside a container and the environment inside the container is completely isolated from the host machine.
- Efficient
- Lightweight
- Self-Contained
- Able to run safe anywhere and everywhere
Useful Links:
- https://hub.docker.com/_/node (Node container setup)
- INFO on "bin/bash": https://unix.stackexchange.com/questions/398543/what-are-the-contents-of-bin-bash-and-what-do-i-do-if-i-accidentally-overwrote
- Dockerfile commands: https://docs.docker.com/engine/reference/builder/#usage
- https://stackoverflow.com/questions/34809646/what-is-the-purpose-of-volume-in-dockerfile (Docker Volumes)
- https://www.linux.com/learn/docker-volumes-and-networks-compose (More on Docker Volumes)
- https://hub.docker.com/_/postgres/ (Docker Postgres Setup Guidelines)
Docker Commands
(NOTE: everytime the yml files are changed you need to run: 'docker-compose build' to reread file)
docker build -t superawesomecontainer .
creates a Docker containerdocker run -it superawesomecontainer
runs the Docker containerdocker run -it -p 3000:3000 superawesomecontainer
runs Docker container using PORTdocker run -t -d superawesomecontainer
runs Docker in the backgrounddocker ps
can see all the containers that are runningdocker exec -it INSERT_HASH_HERE bash
access to Docker containerdocker stop INSERT_HASH_HERE
stops container from running
Docker Compose commands:
docker-compose build
uses Docker Compose to build an image filedocker-compose run NAME_OF_API_OR_CONTAINER
runs Docker Compose containerdocker-compose down
brings back down any Docker containers running in the backgrounddocker-compose up --build
command aggregates the output of each container and builds initial containerdocker-compose up
to bring back up a Docker container prev. builtdocker-compose up -d
to bring back up container in the backgrounddocker-compose exec NAME_OF_CONTAINER bash
access to container bashdocker-compose down -v
removes volumesdocker-compose rm -v NAME_OF_VOLUME
removes specific volume