Contents

Docker Commands

Contents
  1. Create a new container based on the image and start it.
    docker run --name local-redis -p 6379:6379 -d redis

–name : container custom name
-p: port (hostport:containerport)
-d: daemon mode

  1. Run a stopped container
    docker start local-redis

  2. Run a command in the container shell.
    docker exec -it redis redis-cli

-i interactive keeps STDIN open even if detached
-t: virtual tty

  1. List (all) containers
    docker ps -a

-a: all including stopped containers

  1. List images
    docker images