PODS Flashcards
practice k8s pods
Docker commands for
- starting a container
- stop a container
- restarting a container
- kill a container
- remove a stopped container
- inspect a container
- docker start 《img》
- docker stop 《containerID》
- docker restart 《containerID》
- docker kill 《containerID》
- docker rm 《containerID》
- docker inspect 《containerID》 | less
Does docker provide a default name when we do not provide one for the container ?
Yes .docker provides a default name but it is best practice to provide a name yourself as docker names are weird
how to build a docker image ?
Two ways
- you can imperatively run all the commands necessary to build an image
- You can use a Dockerfile which automates the image building
give an example of Dockerfile ?
FROM centos # build from base image
MAINTAINER kcp # id of person who
maintains the dockerfile
ADD /repo/src/main/ # add repo files to
container
RUN yum install && \
yum update killtcp && \
bash && \
yum clean all #can run multiple
commands using \
CMD “/usr/bin “ [“po’,”c” ]
POD
POD contains collection of application containers and volumes running in a same execution environment.
All containers inside a POD land on same.machine
Applications running inside a POD
Share
Same IP
host name
What is Imperative and Declarative configuration
Declarative configuration:
You write down your desired state in a file and submit to k8s and k8s makes sure that desired state meets actual state
Ex. kubectl apply -f pod.yaml
Where pod.yaml is the declarative configuration file
Imperative configuration:
Series of commands run to meet the requirements
Ex. kubectl run nginx –image=nginx