How can I use the containers offer by webdevops/*? - docker

I'm learning about Docker Containers, so, I found this repo with a lot of images and references, can anyone help me in order to understand how can I use those images?
I know the docker run --rm command

With docker you first need a docker image. A docker image is a representation of an application that docker can understand and run.
The most common ways to get one is to use docker pull or to generate yours with docker build.
You can check the images you got with docker images
Once you got your image you can run it with docker run MyImage, this will create a container, a container is a running application.

Related

What is the difference between docker pull and docker image pull commands?

As of now, I am learning Docker. This reference has mentioned two ways of pulling an image from the Docker registry. Can anyone explain this in simple terms?
Does this mean that we cannot get updates on a pulled image if we use docker image pull command?
They are the same command. From the documentation you linked:
To download a particular image, or set of images (i.e., a repository), use docker image pull (or the docker pull shorthand).
There are many "shortand commands" like:
docker push for docker image push
docker run for docker container run
...
What is the difference between docker pull and docker image pull commands?
None.
Can anyone explain this in simple terms?
They are the same.
Does this mean that we cannot get updates on a pulled image if we use docker image pull command?
No.
Also https://forums.docker.com/t/docker-pull-imagename-vs-docker-image-pull-imagename/59283

What is the workflow of a docker image building?

I know to use the "docker build" to build an image from Dockerfile and it would package a tar to Docker daemon.
How does it work on Docker daemon when building the image? Is it create a temporary container?
A Docker image is roughly equivalent to a "snapshot" in other virtual machine environments. It is a record of a Docker virtual machine, or Docker container, at a point in time. Think of a Docker image as a digital picture. A Docker container can be seen as a printout of that picture. Docker images have the special characteristic of being immutable. They can't be modified, but they can be duplicated and shared or deleted. The immutability is useful when testing new software or configurations because no matter what happens, the image will still be there, as usable as ever.

Some questions on Docker basics?

I'm new to docker.Most of the tutorials on docker cover the same thing.I'm afraid I'm just ending up with piles of questions,and no answers really. I've come here after my fair share of Googling, kindly help me out with these basic questions.
When we install a docker,where it gets installed? Is it in our computer in local or does it happen in cloud?
Where does containers get pulled into?I there a way I can see what is inside the container?(I'm using Ubuntu 18.04)
When we pull an image.Docker image or clone a repository from
Git.where does this data get is stored?
Looks like you are confused after reading to many documents. Let me try to put this in simple words. Hope this will help.
When we install a docker,where it gets installed? Is it in our
computer in local or does it happen in cloud?
We install the docker on VM be it you on-prem VM or cloud. You can install the docker on your laptop as well.
Where does containers get pulled into?I there a way I can see what is
inside the container?(I'm using Ubuntu 18.04)
This question can be treated as lack of terminology awareness. We don't pull the container. We pull the image and run the container using that.
Quick terminology summary
Container-> Containers allow you to easily package an application's code, configurations, and dependencies into a template called an image.
Dockerfile-> Here you mention your commands or infrastructure blueprint.
Image -> Image gets derived from Dockerfile. You use image to create and run the container.
Yes, you can log inside the container. Use below command
docker exec -it <container-id> /bin/bash
When we pull an image.Docker image or clone a repository from
Git.where does this data get is stored?
You can pull the opensource image from Docker-hub
When you clone the git project which is docerized, you can look for Dockerfile in that project and create the your own image by build it.
docker build -t <youimagenae:tag> .
When you build or pull the image it get store in to your local.
user docker images command
Refer the below cheat-sheet for more commands to play with docker.
The docker daemon gets installed on your local machine and everything you do with the docker cli gets executed on your local machine and containers.
(not sure about the 1st part of your question). You can easily access your docker containers by docker exec -it <container name> /bin/bash for that you will need to have the container running. Check running containers with docker ps
(again I do not entirely understand your question) The images that you pull get stored on your local machine as well. You can see all the images present on your machine with docker images
Let me know if it was helpful and if you need any futher information.

Launch different containers from a Dockerfile

Is there any possibility to launch containers of different images simultaneously from a single "Dockerfile" ?
There is a misconception here. A Dockerfile is not responsible for launching a container. It's responsible for building an image (which you can then use docker run ... to create a container from). More info can be found on the official Docker documentation.
If you need to run many docker containers simultaneously I'd suggest you had a look at Docker Compose which you can use to run containers based on images either from the docker registry or custom-built via Dockerfiles
Also somewhat new to Docker, but my understanding is that the Dockerfile is used to create Docker images, and then you start containers from images.
If you want to run multiple containers you need to use an orchestrator like docker swarm or Kubernetes.
Those have their own configuration files that tell it which images to spin up.

How do I build docker images without docker?

Is there some lightweight way I can build a docker image within a container without having a working docker machine. Here's what I'm trying to do:
$ docker run -it --rm docker:latest
/ # mkdir test
/ # touch test/Dockerfile
/ # docker build test
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Assuming I had a valid Dockerfile in place, is there some way I could create an docker image from within a container like this?
Part of the problem could be that you're missing the --privileged flag, but in general, your questions can probably be answered here: https://hub.docker.com/_/docker/
And you might take the time to read the blog linked there detailing some of the pitfalls of using docker-in-docker.

Resources