Docker Containers Flashcards Questions Mamun 1-217 set 1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

how to enable ubuntu to tab complete docker commands:

/etc/bash_completion.d/docker.io

when did docker 1.5 come out?

12.14.2016

How many docker images are there on docker hub?

14000 and growing

minimum kernel version needed for docker

3.10

How to make a new docker image?

Ans: 1. write a Dockerfile 2. Now, inside our "Dockerfile" dir, create a. a new config file for the virtual host named default b. a supervisord configuaruon file supervisord.conf c. a service configuration script start.sh 3. docker build -t nginx_image . (in this case, we are making a new nginx image) 4. confirm by running: docker images (new one should now show up)

what happens to the the top most layer (RW) when container stops.

GONE!

What is -d in docker run?

NOT interactive

How to set up k8s

Per Nanit, how to set up k8s: ans: K8s: The first step is to create a Replication Controller which states the Docker image we want to run and how many of it to run simultaneously. After we set it up, we need to create a Service object. This will set up an ELB for us and route traffic from that ELB to the corresponding containers. Bottom line: K8s felt a little bit more comfortable here. The procedure is slightly shorter, and you don't have to manually setup or manage the ELB at all. It is all managed for you by K8s: when you create a service, an ELB is created for you, and when you delete a service, it is automatically deleted from AWS.

Service discovery and docker:

Per Nanit: Service discovery and docker: ans: Service Discovery When you use micro-services architecture in general, and Docker specifically, a good service discovery solution is extremely crucial. Docker containers shift between different VMs all the time and you must have a solid way to reach services both inside your cluster, and outside of it.

T/F: client and daemon does not have to run on the same VM.

True

True/false: amazon ec2 now supports windows containers.

True

Its semi-crazy, but can you do docker on docker?

Yes

nomad

a scheduler like k8s

A list of Dockerfile commands (11)

a. FROM b. MAINTAINER c. RUN d. ADD e. ENV f. CMD g. ENTRYPOINT h. WORKDIR i. USER j. VOLUME k. expose

Why are the containers so light?

all the layers except the top most one in read-only and shared (e.g. ubuntu)

Most popular docker images on docker hub

ans: ubuntu centos nginx redis node postgress mysql mongo debian jenkins

namespace: example:

ans: Namespaces allow you to group services under a logical name. Let's assume we have a production and a staging namespace, both having a redis service in them.

docker command to run ubuntu container and then in it, run a while loop on bash.

ans: $ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" 1e5535038e285177d5214659a068137486f96ee5c2e85a4ac52dc83f2ebe4147

Command to run an ubuntu container :

ans: $ docker run -t -i ubuntu /bin/bash root@af8bae53bdd3:/#

where does DOCKER_OPTS= go?

ans: /etc/default/docker on the vm

Internal structure of docker is made of 3 components:

ans: 1. docker image 2. docker registry 3. docker container

port range for docker (.e.g. to open in aws security group)

ans: 49000-50000 49k-50k

btrfs

ans: Btrfs is a next generation copy-on-write filesystem that supports many advanced storage technologies that make it a good fit for Docker. Btrfs is included in the mainline Linux kernel and its on-disk-format is now considered stable

Dockerfile: ENTRYPOINT

ans: Define the default command that will be executed when the container is running.

Amazon's version of k8s:

ans: Docker orchestration frameworks out there: ECS (Elastic Container Service) by AWS,

All the doocker run commands has folder like so: docker run -d ubuntu user/xyz OR docker run -d ubuntu test/database why?

ans: I dont know. Gussing that dockers containers are organized into folders

docker server ??

ans: I think its the VM that has docker installed

ECS vs k8s:

ans: We were glad to discover that Kubernetes is far more comprehensive and had almost all the features we required. For us, Kubernetes won ECS on ECS's home court, which is AWS of course. (Nanit)

Dockerfile: FROM:

ans: base image from which this nw image will be built

What if you wanted the very latest version of docker , not what apt-get has to offer?

ans: curl -sSL https://get.docker.com/ubuntu/ | sudo sh

to enter a running container, attach a new shell:

ans: docker exec -it container1 /bin/bash

which command to get IP address of a container?

ans: docker inspect (more than IP addresses, but...)

How to totally do away with container my_db_1 ?

ans: docker kill my_db_1

command to get logs from containers:

ans: docker logs ( i guess opions will dictate logs from which container etc.)

magic of docker commands combined with good old unix:

ans: docker ps --filter "status=exited" | grep 'weeks ago' | awk '{print $1}' | xargs WHATEVER

from the vm, command to downlooad a docker image:

ans: docker pull ubuntu

How to restart a container named my_db_1 ?

ans: docker restart my_db_1

If you are deleting a container and you want to also delete the volume associated with it, you must provide what option?

ans: docker rm -v

example docker run command to create a container and then run a command ON THAT newly created container:

ans: docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"

You dont like that fact docker assign randon ids to your containers which is hard to remember. Fix?

ans: docker run -name my_web_server_1 ........ now that container will be named my_web_server_1

how to limit a container to 0.5 CPU core?

ans: docker run -ti --c 512 mamun/container1 (1024 = 1 cpu core)

You can go crazy and give particulat cores...

ans: docker run -ti --cpuset-cpus=0,4,6 mamun/db1

option with docker run command to set memory usage to 300M:

ans: docker run -ti -m 300M ubuntu:14.04 /bin/bash

95. difference bw docker ps -a and docker stats -all ?

ans: ps -a: running and stopped stats -all: running only

once installed, how to run hello world on the vm?

ans: sudo docker run hello-world (here hello-world is a test image!)

How to restart docker server?

ans: sudo service docker restart

can you pull hadoop images from docker hub?

ans: then pulled down hadoop images from docker hub. that worked too! yarn and everything ran MR job, that of course pegged the CPU. terminated instance. Is this thing real??? wow i can't believe it!

What is docker's native solution to persistent storage problem?

ans: you have configure that the docker image does NOT move from that VM (bc the VM has the persistent storage volume)

How to install docker on mac?

ans: you have to install Boot2Docker : which is a VM with docker installed and runs as a daemon. docker client on mac communicates with that daemon via Docker Remote API.

what docker.io (package name)

because ubuntu already had a package called docker

to install docker on windows or mac, you have to use:

boot2docker

Dockerfile: ADD:

copy a file from host to docker image

what does docker run command do?

creates container

command to attach to a container

docker attach

command to make several docker instances and make them work together:

docker compose

command to cp files between a container and local FS of host VM: (like hdaoop)

docker cp

which command creates container but does not start it?

docker create

command to see what files have changed on a container:

docker diff

command to get events form containers:

docker events

How to execute a command in a container?

docker exec

can you free a container in its place?

docker freeze

command list all the images "locally" available

docker images

Which command to see the public facing port of container:

docker port

command to lists all running containers:

docker ps

command to delete a container

docker rm

command to start a container

docker run

How to start a transient container? (i.e. it will be autimatically removed when it stops)?

docker run --rm

How to map a dir on host vm to a dir on a container:

docker run -v $HOSTDIR:$DOCKERDIR

command to get resource usage metrics from containers:

docker stats

command to stop a container

docker stop

which command shows running processes on a container?

docker top

How to modify a container's resource limits?

docker update

Name of the bridge interface that docker installs on the host VM

docker0

Dockerfile: CMD:

execute a commands

first column in the output of docker ps?

id of the container

Rancher

its like k8s (orchestration, scheduling and more)

Short form of Kubernetes?

k8s

How does k8s provide a better solution to this problem (than ECS)

k8s allows you to mount an EBS volume which WILL MOVE when the docker image moves from VM to VM. (ECS , which just provides docker's native solution) does not provide this. Another win for k8s.

Startup speed comparison between docker container and a VM

milliseconds vs minutes

example of when you will need persistence storage

mysql

Docker file really is just a _____

script

SoA

service oriented architecture = N microservices

docker client talks to docker daemon via:

socket

What is micro-services?

software is devided ibto many small services. each service is then serviced from multiple (10,100,1000) servers. each micro service wil have its API This is conttrast to frontend-middle-db model which is too complex to release and troubleshoot.

29. How to build a docker image:

source: http://www.projectatomic.io/docs/docker-building-images/ STEP A: dockerfile FROM fedora-httpd MAINTAINER A D Ministator email: [email protected] # Add the tar file of the web site ADD mysite.tar /tmp/ # Docker automatically extracted. So move files to web directory RUN mv /tmp/mysite/* /var/www/html EXPOSE 80 ENTRYPOINT [ "/usr/sbin/httpd" ] CMD [ "-D", "FOREGROUND" ] STEP 2: build # docker build -rm -t mysite . STEP 3: run # docker run -d -P mysite

How to install docker on a ubuntu VM?

sudo apt-get update; sudo apt-get install docker.io

what does it mean to attach to a container?

to see its console

on internet docker seems to be on ubuntu/centos?

ubuntu

how to get kernel version ?

uname -r

How does docker container communicate with the host VM?

via a bridge

command to download and install docker on the vm:

wget -q0- https://get.docker.com/ | sh

Can Rancher do LB

yes

Is Rancher Stateful

yes

T/F: docker images are read-only

yes

does Kubernetes have UI?

yes

does Rancher have UI?

yes

can you send SIGKILL to a container

yes. docker kill

can you rename a container?

yes. docker rename

Can you use docker and jenkins in combination ?

yes. for example, Jenkins can build bunch of containers (and more)

connection bw docker and microservices?

you can have N docker container provide each microservice. THATS THE WHOLE IDEA.


Ensembles d'études connexes

Organizational Management Chapter 8

View Set

Fundamentals Ch. 32: Skin Integrity and Wound Care

View Set

Business Data Communications Quizzes

View Set

NU 221 - Diuretics & Anti-HTN (Exam 4)

View Set

Recombinant DNA Technology - Microbiology - Chapter 8 Bauman

View Set