Commands to run a minimal docker container.
cname is the name of our image and its tag. Stop and remove a container.
docker stop cname
docker container rm cname
Build a container in the current directory.
docker build --tag cname .
Run a container.
export PORT=8080
docker run -d -p ${PORT}:${PORT} --name cname cname
Run an image with an interactive shell.
docker run -it cname bash
It is convinient to organize this shit in a Makefile.
PORT := 8080
dev:
docker run -it cname bash
run:
docker run -d -p ${PORT}:${PORT} --name cname cname
build:
docker build --tag cname .
Feel free to comment here below. A Github account is required.