The most useful docker commands

List of containers: docker ps

List of images: docker image ls

Build container from dockerfile in current directory: docker build -t [container name] .

Run container in the background: docker run -d -p [container port] : [host port] [container name]

Get logs from container: docker logs [container hash]

Login to container: docker exec -it [container hash] bash

Leave a Reply

Your email address will not be published. Required fields are marked *