1

I need to clone code while creating docker container not while building image. How can we achieve this or How can we run commands while creating container. I have used CMD git clone "URL" in docker file but is giving error "Option 'c' is unknown. Ignoring" while running container.

6
  • Why do you want to do this? The command when you create the image is an endpoint and more recommend to run the application. Commented Apr 29, 2020 at 7:53
  • @CharlesXu I explain in details. I need to have online IDE code assessment for students. So I have used code-server as online VS code editor. I need to have different projects to give to students so they will code it and check in the code. So I am trying to clone git project while container creation . Commented Apr 29, 2020 at 8:41
  • I am planning to create new branch for every students once they start assessment and they can check in code there. You can guide if you have any better solution on this. Commented Apr 29, 2020 at 8:43
  • @CharlesXu one more thing I tried RUN git clone --progress --verbose https://github.com/sanjayme97/dotnet-core-demo.git in docker file but while building git code is not cloning it shows ``removing intermediate container``` and skipping the command. Commented Apr 29, 2020 at 8:49
  • It just removes the layer, I think it does not affect the image. See the issue. Commented Apr 29, 2020 at 9:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.