Docker: Find dockerfile of images - docker

I'm interested in how some images are build, and would like to know where docker saves the images/Dockerfile. I'm using a Mac and the docker version is 1.9.0. On google I see a lot about boot2docker but I don't seem to have that executable. I simply click the Docker Quickstart terminal and I can do
$> docker run dockerinaction/hello_world
I noticed that for the hello-word image I can find the dockerfile on hub.docker.com, but for onedio/base-node5 I can't. Is it possible to find the Dockerfile for base-node5 on hub.docker.com ?

Use dockerfile-from-images from centurylinkabs, that will create the Dockerfile, see https://github.com/centurylinklabs/dockerfile-from-image

You can get a lot of that info from the Docker History command
docker history onedio/base-node5

Related

sharing docker image without docker hub or any such service

I am new to docker, I was wondering how can I share my docker image with others without posting it on docker hub or any thing?
Is there any way to share image with others and later they can build the same image and run the dockerised application in their pc?
some solutions
you can give the source code and the dockerfile to someone, he will be able to build the image himself.
you can build it yourself , host the image on a private registry. really easy : https://docs.docker.com/registry/deploying/
use "docker save" to export an image as a tar file and later "docker load" it.
https://docs.docker.com/engine/reference/commandline/save/
You can use
$docker export <container_name> <tar_filename.tar>
Share the tar file
The person with whom the tar file has been shared can create container by
$docker import <tar_filename.tar>
Make sure that underlying Docker version is same to avoid unnecessary compatibility problems

How can I update Docker image after changing few lines of code in my app?

Dockerfile I just built a Docker image using the below command in my app working directory:
docker build -t imagename:latest .
The Docker image is successfully built after a few minutes and the application is running as well once I used the below command:
docker run -p portnumber:portnumber imagename:latest
But now I want to update 2 lines of code in my application codebase. Suppose I added the code and wants to see if my application is working or not so how could I do that? Do I need to follow the below steps?
1. Delete the Docker image
2. Rebuild the image using the above command
3. See if the app is working or not using the "docker run" command?
I want to know that how can I update my Docker image? My Dockerfile is the same and there won't be any changes. I don't want to rebuild the whole Docker image again because initially, the size of all packages were around 2GB. Can anyone help me that what should I do next? Thanks in advance.
OS: Ubuntu
Application framework: Streamlit
Although you asked specifically how to update (rebuild) your docker image, it is my guess that you are in fact in need of a different solution.
If you are developing on a dockerized version of your application (which is good), it is impractical to rebuild the image with every change you do in your code.
A better, and more common approach, is to mount your local folder into the container, so the running container and your local machine actually share a folder.
This way you can just edit your code, and it is reflected in the container immediately.
So, your docker run command might look something like this:
$ docker run -v $PWD:/path/to/app/in/container -p PORT:PORT IMAGE_NAME
Read more about docker volumes.
Read more about docker for development environments.
Read about using docker-compose for development.
Rebuilding your docker image might not be as much as a hassle as you think !
When you build an image, each line with the command RUN, COPY or ADD of your Dockerfile is made into a layer of your image. When you rebuild the image, only the updated lines of the Dockerfile should rebuild. If you do not delete the old image so that it's in cache, that is.
If you try it, you should see only one or so layers of your image updating (and those below it)
An alternative would be to not put your code into your build and to insert it in the container with a volume at runtime. Depending on your use, it could be something. But it is a quite different use case and might not apply.

Is it possible to build AOSP inside a docker container with alpine flavour?

I'm very much new to AOSP and I'm trying setup the complete AOSP on the Docker to build a Docker Image like Alpine or Ubuntu image, if it not possible please let me know the reasons why it is not possible to setup AOSP inside the docker image.
Or Do I need to write the Dockerfile to build the image?
Please help me if it possible with some good snippets.
Thanks in Advance :)
Android team has provided a Dockerfile, docker build command to build the image, and docker run command to run a container : https://android.googlesource.com/platform/build/+/master/tools/docker
As mentioned there, you can mount your local AOSP source tree to the container using -v option in docker run command.
I have not tried to build AOSP in a Docker container. But in this question, #VasileM has mentioned that he uses the Android provided Docker instance to build AOSP.

Docker Image history without using docker history command

I have a docker image. I want to analyze the docker image history, for this I can use docker image history command in the docker installed environment.
But when am working in a Openshift cluster, I may not have the access to the docker command here. So here I want get the docker history command result for the given image.
So basically I have a docker image and I don't have docker installed there. In this case how can we get the history of that docker image?
Can anyone please help me on this?
You can get the registry info either via curl or skopeo inspect. But the rest of the metadata is stored inside the image itself so you do have to download at least the final layer.

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.

Resources