Title: 544
Tags: lec4

Q: If you want to download an image X from DockerHub to your VM, what command do you use?
A: docker pull X

Q: How can you see all the Docker images on your VM?
A: docker images

Q: How can you give a Docker image "a" an additional second name, "b"?
A: docker tag a b

Q: How can you launch a container from image X?
A: docker run X

Q: How can you see existing containers?
A: docker ps

Q: How can you delete a container X?
A: docker rm X

Q: How can you delete an image X?
A: docker rmi X

Q: How can you see Docker's disk utilization?
A: docker system df

Q: How can you cleanup unnecessary Docker data to free up space?
A: docker system prune

Q: How can you see the output (for example prints) for an application running inside container X?
A: docker logs X

Q: How do you run a command (lets say "ls") inside a running container X?
A: docker exec X ls

Q: How do you see resource consumption of running containers?
A: docker stats

Q: How do you get a bash shell inside an existing container X?
A: docker exec -it X bash

Q: How do you cause a container X to stop running?
A: docker kill X

Q: How do you run the Dockerfile in the current directory to build an image X?
A: docker build . -t X

Q: What is the difference between "docker rm" and "docker kill"
A: After "docker kill", the container won't be running, but it will still exist (you can see it with "docker ps -a").  "docker rm" actually cleans up the space that was used by that container.

Q: In a Dockerfile, how do you specify a base image X?
A: FROM X

Q: In a Dockerfile, how do you execute a command, say "apt update"?
A: RUN apt update

Q: In a Dockerfile, how do you copy a file X.txt (in the same directory on the VM) to /Y.txt (in the image)?
A: COPY X.txt /Y.txt