Docker Commands
Contents
- 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
-
Run a stopped container
docker start local-redis
-
Run a command in the container shell.
docker exec -it redis redis-cli
-i interactive keeps STDIN open even if detached
-t: virtual tty
- List (all) containers
docker ps -a
-a: all including stopped containers
- List images
docker images