Professional Documents
Culture Documents
2. Using the Docker file create an image OR pull the image directly from the docker registry
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-108.git4ef4b30.el7.centos.x86_64
Go version: go1.10.3
Git commit: 4ef4b30/1.13.1
Built: Tue Jan 21 17:16:25 2020
OS/Arch: linux/amd64
Experimental: false
Two different ways to create a docker container. How to create a container Option #1
# mkdir dock
# cd dock
#vi Dockerfile
FROM debian
RUN mkdir -p /opt/libeatmydata
ADD zip.txt /opt/libeatmydata/
RUN ls -lRt /opt/libeatmydata
# docker build -t hello1 . [In this command you are building an image with the name of “hello1”]
# docker images
# docker run hello1 [This command will finish the task in two secs but it will show you the container id]
a001a8a9c90ffb41e9e7387d197893f56bf26b4c7ed7b57068a1a7cf88355096
#
How to create a container Option #2
# docker pull hello-world [You are pulling an image from the docker registry called “hello-world”]
# docker images
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
# docker run -it ubuntu bash [This command pulls an image from the docker registry and creates a running container]
# docker images
Why there is no containers running? Docker containers can run execute a task and terminate
# docker container ls
[root@nfs home]# docker run hello1 [Works for two seconds then stops]
a001a8a9c90ffb41e9e7387d197893f56bf26b4c7ed7b57068a1a7cf88355096 [This is the container id]
[root@nfs home]#
Other containers can run and keep running as daemons, the same way as we have them in Transformation Hub
# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a85c81c3859e ubuntu "bash" 15 seconds ago Up 14 seconds dazzling_jang
How do these concepts and commands apply/work on Transformation Hub?
Check the number of images in master and worker nodes of the Transformation Hub Installation. The number of images
between master and worker nodes should be different. The initial master works as the private docker registry and
worker nodes contain the images of the containers running in that node.
Remember: The scheduler assigns the containers to every node. The kubelet in every node constantly checks for pods
assigned to the node and signals the docker daemon to pull the images when the scheduler has assigned those images
to the node. The docker daemon starts and runs the containers.
There are several commands you can use as part of your troubleshooting session. But keep in mind that most of the
time the issue may not be inside a container, but with ports, daemons/services not running, etc. and you have to use
other commands to find the problem
# docker stats
# docker container ls
Note: You can type “# docker” for additional commands you can try.
Note: You can also see the pods and their information by executing the following commands.
# kubectl describe pod itom-k8s-dashboard-86ccd46b6c-49b4x -n core [In this case you will see 2 Container IDs]