docker run sed doesn't work docker run sed doesn't work docker docker

docker run sed doesn't work


You did not change the image. You started a container, based on the image. Then you ran your sed command and changed the file contents. Check docker ps -a to see the id of the container that just closed. If you use docker cp to extract your file you should see that it was changed as expected (assuming your sed command was ok).

You could also create a Dockerfile

FROM some/imageRUN sed -i 's/main/main contrib/g' /etc/apt/sources.list# this command is just temporary, you probably are going to do something elseCMD cat /etc/apt/sources.list

and run the new image docker run some/new-image to get the expected output.

Conclusion - you probably want to do run your sed command in the original images Dockerfile.