Intelligence = Applied Curiosity with a coefficient of how fast that curiosity is applied and satisfied.
Friday, September 21, 2018
Docker: Understanding Docker Images and Containers
So this week has been emphasized on understanding how Docker works.
First, I learned about Docker images - how to create images, etc.
There is a pretty good blog that can be used to get going on this topic, which can be found here:
https://osric.com/chris/accidental-developer/2017/08/running-centos-in-a-docker-container/
Docker images are actually created in Layers. So you generally start off by pulling in a docker container image for centos, and then running it.
This is done as follows;
# docker pull centos
# docker run centos
# docker image ls
Note: If you run "docker container ls" you won't see it because it's not running and therefore not containerized. Once you run the container image, THEN it becomes containerized and you can run "docker container ls" and you will be able to see it.
# docker run -it centos
Once you run the image, you are now "in" the container and you get a new prompt with a new guid, as shown below:
[root@4f0b435cbdb6 /]#
Now you can make changes to this image as you see fit; yum install packages, copy things into a running container by using the "docker cp" command.
Once you get a container the way you want it, you can exit that container, and then use the guid of that container (don't lose it!) to "commit" it.
Once committed, you need to push it to a registry.
Registries are another topic. If you use Docker Hub (https://hub.docker.com), you need to create an account, and you can create a public repository or a private repository. If you use a private one, you need to authenticate to use it. If you use a public one, anyone can see, take or use whatever you upload.
JFrog is another artifact repository that can be used.
Ultimately what we wound up doing, is creating a new local registry in a container by using the following command:
# docker run -d -p 5000:5000 --restart=always --name registry registry:2
Then, you can push your newly saved container images to this registry by using a command such as:
# docker push kubernetes-master:5000/centos-revised-k8s:10
So essentially we did the push to a specific host (kubernertes-master), on port 5000, and gave it the image name and a new tag.
Subscribe to:
Post Comments (Atom)
Zabbix to BigPanda Webhook Integration
Background BigPanda has made its way into the organization. I wasn't sure at first why, given that there's no shortage of Network Mo...
-
After finishing up my last project, I was asked to reverse engineer a bunch of work a departing developer had done on Kubernetes. Immediat...
-
Initially, I started to follow some instructions on installing Kubernetes that someone sent to me in an email. I had trouble with those, s...
-
On this post, I wanted to remark about a package called etcd. In most installation documents for Kubernetes, these documents tend to abstr...
No comments:
Post a Comment