Dockerfile "RUN git clone" removes intermediate container

I am using Boot2Docker on Windows 7 to build my development environment using a Dockerfile. When I run docker build -t myimage dir/of/docker/file

then everything works fine up to this line:

RUN git clone --verbose https://github.com/zsh-users/antigen ~/.antigen/antigen

      

The output of this line is:

Step 12 : RUN git clone --verbose https://github.com/zsh-users/antigen ~/.antigen/antigen
---> Running in 26cba91e912a
Cloning into '/root/.antigen/antigen'...
POST git-upload-pack (302 bytes)
---> e0012659884b
Removing intermediate container 26cba91e912a
Successfully built e0012659884b

      

A clone (public repository) is discarded, ~ / .antigen / antigen does not exist in the container. "Cloning to ..." is red, so I think there is something wrong with the team. But if I run it in a container shell (opens docker run -it myimage

) it clones it.

Am I doing something wrong, or can I do some customization for use git clone

in the docker file? Here's its full content:

FROM debian:testing
MAINTAINER BimbaLaszlo

RUN apt-get update

RUN apt-get install -y curl

RUN apt-get install -y gcc g++ make
RUN apt-get install -y ctags
RUN apt-get install -y git

RUN apt-get install -y python python-pip python3 python3-pip

RUN apt-get install -y ruby ruby-dev
RUN gem install ripper-tags gem-ripper-tags
RUN gem install pry byebug

RUN apt-get install -y zsh
RUN git clone --progress --verbose https://github.com/zsh-users/antigen ~/.antigen/antigen

      

+3


source to share


1 answer


The color you see in red is not caused by an error. This is because it git clone

does not use STDOUT

, we can check it by running the following command:

$ git clone --progress --verbose https://github.com/zsh-users/antigen > /dev/null
Cloning into 'antigen'...
POST git-upload-pack (255 bytes)
remote: Counting objects: 1291, done.
remote: Total 1291 (delta 0), reused 0 (delta 0), pack-reused 1291
Receiving objects: 100% (1291/1291), 1.10 MiB | 900.00 KiB/s, done.
Resolving deltas: 100% (688/688), done.
Checking connectivity... done.

$ git clone --progress --verbose https://github.com/zsh-users/antigen 2&> /dev/null

      

In the first command, I redirected everything STDOUT

to /dev/null

, we can still see the output. But in the second command, I redirected everything STDERR

to /dev/null

, so we didn't see anything.



And in docker build

, if any pin is not in STDOUT

, it will be red. What is it.

Nothing happens in your Dockerfile.

+4


source







All Articles