Unable to change nginx.conf file
As it turns out, the parent image has already added a specific file into the image, which is read-only. This means you sadly can't change or overwrite the file.
A hacky solution to this is to mount the /etc/nginx/conf.d
folder into a directory on your host (let's say /usr/local/share/nginxconf
) and change the file there, which is in another namespace and different permissions (afaik). It worked on my end.
docker create -v /usr/local/share/nginxconf:/etc/nginx/conf.d --name flask-test IMAGE_NAME
vim /usr/local/share/nginxconf/nginx.conf
Another, fancier solution would be to take another parent image, which doesn't add the file beforehand. But I don't know what dependencies you need for your app, so it might be a painful search. You could of course also create your own (which would also give you some training in writing Dockerfiles).
References to writing a successful Dockerfile:
Dockerfile Reference
Dockerfile Best Practices
Handy tutorial to dockerize PostreSQL by Docker
I suggest you to put your config file in a volume, so you can edit the file on the host and it will be changed inside the container as well.
To do that, you can run your container with
docker run -d -v /path/to/changes/nginx.conf:/etc/nginx/conf.d/nginx.conf IMAGE_NAME
After a change of the config, don't forget to test and apply the config with
docker exec -ti CONTAINER_NAME /bin/sh -c "nginx -t && nginx -s reload"
Also I advise you against installing vim inside the image, as images are supposed to be lightweight and unnecessary packages should abstain from being installed