We have a docker container which I run as:
docker run --name myname -e PROPERTY1=VALUE1 -d image/name
Dockerfile used to build the container:
ADD start.sh /
CMD ["/bin/bash","/start.sh"]
Can I edit the file start.sh without rebuilding the container.
My guess is
How do I edit the file when the container is stopped?
Thanks.
You could follow the steps you outlined, but it requires knowing exactly where the container filesystem is on the host and making sure you have the right permissions to modify it. That's not the path I'd suggest.
Ideally you'd do everything through a Dockerfile
so that you have a reproducible way to rebuild the image in the future. You'll want that in six months when packages or dependencies need updating. You already know how to do that, so I'll presume you're looking for a quick hack.
docker run
your image to get it going as a containerdocker exec -it CONTAINER /bin/bash
(or equivalent shell) to get into the running container. Edit your file within the container. Exit (ctrl-D typically).
docker commit CONTAINER REPOSITORY:TAG
docker run REPOSITORY:TAG