Docker is a tool using containers and images to run programs in isolated environments.
Basic usage
To create a single container and run it on a localhost port:
- Create
Dockerfile
in the app directory- Define starting image
- Set working directory and copy the program
- Install dependencies
- Run program
- Build the container image
docker build -t <tag> .
- Run the image
docker run -d -p <host_port>:<container_port> <tag>
, the-d
switch detaches the console