简体   繁体   中英

How to run some script inside Docker Container?

I have few git repos which are required to build application. I have written one Dockerfile to clone the repo,checkout to development branch and run commands to build the application. I am able to build the docker image properly with this dockerfile. But now i want to use some shell script "update.sh" since i have multiple git repos to update inside the dockerfile, such that code should be updated and build will be made on the updated code. I have tried to keep the same in Dockerfile, but it is not updating everytime, first time it has updated, and from next time it is taking that image from cache.

Infrastructure Details: I have 8 git repos as below:

A-->B-->C-->D and so on

I have made one script to clone & update other repositories and kept inside A. Issue is when i am running the script, first time it is running, but from next time it is taking the things from cache.

Could someone help me in getting it done.

you can build you Dockerfile with:

docker build --no-cache

to avoid your cache issue.

I googled and found solution here . It worked for me.

FROM foo
ARG CACHE_DATE=2016-01-01
RUN git clone ...
docker build --build-arg CACHE_DATE=$(date) ....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM