Lec 04
docker COMMAND
pull: pull a image from registeries to # docker pull ubuntu:23.10
images: lookup current images. # docker images
tag: change tag. Can have different tag for same image.
run: start a new container and execute the command. #docker run unbuntu echo hello.#automatically pull as well
ps: - list all containers. #ps -a all containers not cleaned up. #docker ps -ap quiet.
rm : remove container. #dovker rm name/id #docker rm use ` surround command.
rmi: remove images.
system df: # docker system df - show docker disk usage
system prune: clean up.
logs: see what is printing out. #docker logs container name. #-f watch
exec: starts a new program in a existing container. #docker exec -it mystifying_bajai bash
stats: show resouces for each container.
kill: kill a container - stop running (not remove) docker kill container
build: #docker build . -t demo2 (t for tag) - build a iamge
Dockerfile INSTRUCTIONS
15. FROM: -base image. #FROM unbuntu:23.10
16. RUN: - command. #RUN apt-get update. RUN apt-get install unzip. (apt-get for scripts, )
put in same lne, RUN command && command."add -y, apt-get install -y".
17. COPY: #COPY frommycomputer tocontainer. (relative path, /path/file)
18. CMD: execute command ["list of command"]
Docker can help with set up environment for deployment.
Can help with resource, resource limit etc.
Images: snapshot of installed software from which to create a container.
Registeries. pull image from registeries
Image -> containers.
e.g for detached
docker run -d ubuntu sh -c "echo hello; sleep 300; echo bye" (-d run in backgrond)
Last updated