Docker Community Forums

Share and learn in the Docker community.

How can I update single file in docker image (i.e some aspx page)

build
docker

(Ankur00786) #1

I am new with docker, I am using asp.net application with docker image/container. so I have some query –

  1. How can I update single file in docker image (i.e some aspx page).
  2. How can I make multiple image on one static IP.
  3. User specific files are not removed if I make images multiple times?

(David Maze) #2

Make the change in your build environment and re-run docker build. You will get a totally new image, but images can share parts; in effect, the later in your Dockerfile the thing that changed is, the faster the rebuild will be and the more that will be shared with previous iterations of the image.

Images don’t have networking configuration. That running containers happen to is an implementation detail. If you read through this forum you can read lots of cases of people trying to impose a network configuration on Docker and struggling with it.

What you can easily do is run a container publishing a specific port on the host system. There’s an example of this in the Docker Containers tutorial. If you have multiple containers they’d each run on separate ports, and be accessible from outside via the host system’s DNS name or IP address.

I don’t understand this question. Can you share your Dockerfile and give an example?


(Ankur00786) #3

User specific files are not removed if I make images multiple times?—Means if I have user specific data in our application folders then we re-created docker image after 15 days , is user data has been changed or persist?


(David Maze) #4

You need to delete and recreate containers extremely routinely. “Because I have newer application code and need to update the underlying image” is one reason; if you browse the forums people frequently need to change environment variables, exposed ports, and other configuration that’s only settable from docker run.

You should set up Docker volumes so that user data is stored somewhere other than your container. You should be able to stop your entire stack, delete all your containers, and restart your entire stack without having any effect on the underlying data. It takes some advance planning, but it saves a lot of trouble if you have disk trouble and the only copy of your data is in a strangely formatted filesystem space with long hash-keyed directory names you can’t really read.