2

I am using docker-compose to manage Docker. Now suppose I want to update a source code in one of the Docker containers.

Can I do it using the exec but then how to copy the code from host to running container ?

Or is there any better solution to do the above task ?

2 Answers 2

1

It's a bad practice. You need to use Continuous Integration rebuild docker image (see Dockerfile) every time when source code changed.

2
  • can you suggest some suitable CI/ CD lib or software for the same ? Commented Sep 28, 2018 at 8:46
  • 1
    Drone CI, Jenkins, Travis CI Commented Sep 28, 2018 at 10:58
0

In terms of doing it once to verify how this is done you can use the docker cp command from the host machine -> https://docs.docker.com/engine/reference/commandline/cp/

But I agree with Meiram, this is bad practice. You want to be able to have the ability to revert back to a previous version of not only the code but also the container.

There is a very good tutorial here integrating Docker/DockerHub with Github, Jenkins, and even Sonarqube.

https://medium.com/@hakdogan/an-end-to-end-tutorial-to-continuous-integration-and-continuous-delivery-by-dockerize-jenkins-f5b9b45b610d

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.