# Inside the folder with Dockerfile
docker build -t <image_name> .
-
Regular:
docker run <image_name>
-
Binding a port at run time:
docker run -p <container_port>:<host_port> <image_name>
-
Setting a name for the container at run time:
docker run --name <container name> <image name>
-
Running a container in the background (detached):
docker run -d <image_name>
docker image ls
docker image rm [image name]
docker image rm $(docker images -a -q)
docker ps -a
docker stop [container name]
docker stop $(docker ps -a -q)
docker rm [container name]
docker rm $(docker ps -a -q)
docker logs [container name]
# In the repository with docker-compose.yml
docker-compose build
-
Regular:
# In the repository with docker-compose.yml docker-compose up
-
Background (Detached mode):
# In the repository with docker-compose.yml docker-compose up -d
docker rmi $(docker images -f “dangling=true” -q)
docker exec <command>