Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After pulling a Docker from the repository, how to change the images files?

Tags:

docker

nginx

I installed a docker image from the registry by doing.

docker pull paintedfox/nginx-php5

Now I wish to make some changes to this nginx's config files to add some domains. I believe the config files are somehow help inside the dockers image, but where is the image? How can I change these config files?

like image 513
Phil Avatar asked Feb 04 '14 09:02

Phil


People also ask

How do I run a docker image after pulling?

If you want to run docker image which pulled from the remote repository just use the IMAGE ID instead of Image name (Repository).

Where are the files after docker pull?

The storage location of Docker images and containersUbuntu: /var/lib/docker/ Fedora: /var/lib/docker/ Debian: /var/lib/docker/ Windows: C:\ProgramData\DockerDesktop.

Can we change docker image?

Docker images can now be edited simply and reliably. This is an example of a Dockerfile for a Zabbix monitoring container. To change the image used by an existing container, we must first delete it, then edit the Docker file to make the necessary changes, and then recreate the container using the new file.


1 Answers

You can run a shell in the image, with:

docker run -t -i --entrypoint bash paintedfox/nginx-php5

Then change the configuration files as you like. Note the container ID (it appears in the prompt, e.g. root@9ffa2bafe2bb:/#), then commit it to a new image:

docker commit 9ffa2bafe2bb my-new-nginx

You can then run the new image (my-new-nginx).

like image 56
jpetazzo Avatar answered Sep 18 '22 22:09

jpetazzo