Docker Community Forums

Share and learn in the Docker community.

Docker build two images (should one)

build
automatedbuilds

(Mariotti) #1

Hi there!

I’ve got a problem with building and running images.

Let’s start from the beginning.
Here is a docker librenms: https://github.com/setiseta/docker-librenms
Whole directory i’ve copied to my own repository and changed some settings in some files and also added my own files. And now, i’m trying to execute my own image. So i run those commands:
git clone http://url_to_my_git
docker build -t myimage:v1 cloned_repo_dir/

After that i get two images: phusion/baseimage:0.9.18 (that we can find in Dockerfile of original repo) and myimage:v1.
After that i can execute docker run with additional commands (like on original docker-librenms site).

My question is: how to have only one image (myimage:v1) without dockerhub?
I use docker build and docker run. But on the site is just docker run command and name of the image at dockerhub.


(Nathan Le Claire) #2

I’m not sure I understand the question?

If you want to run your own image, just docker run myimage:v1 with the parameters specified for the original one.


(Mariotti) #3

Yeah, i did but before that i have two images. One - image that was downloaded with docker build and second one - image which was the result of docker build command (myimage:v1).

What i want to have is just one image: myimage:v1.


(Nathan Le Claire) #4

Why?

docker must pull, and then use, the base image as part of the build process – images are layered on top of one another, so there’s no way around this. Having an image around is extremely cheap (the copy-on-write filesystem layering can actually help to reduce disk usage dramatically), so why not?