Friday, April 17, 2020

8 beginners commands to start with Docker


Installation guides:


windows - https://docs.docker.com/docker-for-windows/

linux - https://docs.docker.com/engine/install/

mac - https://docs.docker.com/docker-for-mac/install/


docker basic
  1. List currently running docker containers:
    docker ps
  2. List all docker containers (running and stopped):
    docker ps -a
  3. Start a container from an image, with a custom name:
    docker run --name container_name image
  4. Start or stop an existing container:
    docker start|stop container_name
  5. Pull an image from a docker registry:
    docker pull image
  6. Open a shell inside of an already running container:
    docker exec -it container_name sh
  7. Remove a stopped container:
    docker rm container_name
  8. Fetch and follow the logs of a container:
    docker logs -f container_name

No comments: