DevOps Flashcards
1
Q
How do you create a docker image?
A
docker run -p localport:conatinerport {-d optional} {–name optional} imagename
2
Q
How to detach the running docker from terminal?
A
By adding -d
docker run -p -d localport:conatinerport {-d optional} {–name optional} imagename
3
Q
How do you get a new image from repo in docker
A
Docker pull nameofimage
4
Q
How to build an image on docker
A
docker build -t{tagname} .
5
Q
What is docker network?
A
Docker networking enables a user to link a Docker container to as many networks as he/she requires. Docker Networks are used to provide complete isolation for Docker containers.
6
Q
Explain the steps in dockerization
A
- docker pull image
- docker run -p {p1:p2} –name name image
- create Dockerfile
- docker build -t appname .
- docker run -p {p1:p2} –name name -e dbhost -e dbname image // this fails
- docker netwoek create net-name
- docker network connect net-name appname
- docker run -p {p1:p2} –name name –net netname -e dbhost -e dbname image //shudnt fail
7
Q
How to push a docker image to dokcer hub?
A
- give tag names for images with docker image tag sourcename tagname
- docker push username/taggname