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

CC BY-SA 4.0
2018-09-28T08:46:42.743Z
can you suggest some suitable CI/ CD lib or software  for the same ?
Abhijit Gujar
CC BY-SA 4.0
2018-09-28T10:58:38.873Z
Drone CI, Jenkins, Travis CI
Meiram Chuzhenbayev
CC BY-SA 4.0
2018-09-28T08:37:11.787Z
2018-09-28T08:37:11.787Z
Meiram Chuzhenbayev
<p>In terms of doing it once to verify how this is done you can use the <code>docker cp</code> command from the host machine -> <a href="https://docs.docker.com/engine/reference/commandline/cp/" rel="nofollow noreferrer">https://docs.docker.com/engine/reference/commandline/cp/</a></p>

<p>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. </p>

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

<p><a href="https://medium.com/@hakdogan/an-end-to-end-tutorial-to-continuous-integration-and-continuous-delivery-by-dockerize-jenkins-f5b9b45b610d" rel="nofollow noreferrer">https://medium.com/@hakdogan/an-end-to-end-tutorial-to-continuous-integration-and-continuous-delivery-by-dockerize-jenkins-f5b9b45b610d</a></p>

CC BY-SA 4.0
2018-09-28T12:37:23.583Z
2018-09-28T14:55:52.083Z
2018-09-28T14:55:52.083Z
janDro
<p>I am using docker-compose to manage Docker. Now suppose I want to update a source code in one of the Docker containers.</p>

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

<p>Or is there any better solution to do the above task ?</p>

<docker>
How the use Docker exec to update code into a running container
Abhijit Gujar
# How the use Docker exec to update code into a running container

(Asked by: username_0 on 2018-09-27)

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 ?

**Tags:** docker


---

## 2 answers

### Answer by username_1 on 2018-09-28. Score: 1

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

> **Comments:**
> **username_0**: can you suggest some suitable CI/ CD lib or software  for the same ?  
> **username_1**: Drone CI, Jenkins, Travis CI  

---

### Answer by username_2 on 2018-09-28. Score: 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>


---

