Docker – Command Line Cheat Sheet

    To get Docker version and info

    docker --version

    To get Docker details

    docker version

    Build Docker image with tag

    docker build -t <image-name> .

    Push Docker image

    docker push <image-name>

    Execute Docker image

    docker run <image-name>
    docker run --rm -p 3005:3005 <image-name>
    docker run -d -p 5672:5672 -p 15672:15672 <image-name>

    List Docker images

    docker image ls

    List Docker containers (running, all, all in quiet mode)

    docker container ls
    docker container ls --all
    docker container ls -aq

    List Docker Networks

    docker network ls
    docker network inspect bridge

    Stop and remove all Docker containers

    docker stop $(docker ps -a -q)
    docker rm $(docker ps -a -q)

    Bhuvan Balasubramanian
    Follow me
    Latest posts by Bhuvan Balasubramanian (see all)

    Leave a Reply

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