3

I have an app developed in asp.net-core 2.0 and deployed on Linux with Docker.

So I created Docker image and run it on Linux server like:

docker run -p 80:80 --name my-container my-image:1.0

So from Docker image my-image:1.0 created container my-container

Now the issue is when I make some changes to my app and want to deploy that changes I have to stop/remove my-container and create a new one from new Docker image like:

docker stop my-container
docker rm my-container
docker run -p 80:80 --name my-container my-image:1.1

Is there any way to just update the container with the new image? Point is to use existing container with the new version of the image.

1
  • Considering the immutable nature of Docker images and containers, the answer will be no. Commented Sep 4, 2017 at 22:29

1 Answer 1

1

Is there any way to just update the container with the new image?

No. But this is not what you need, since you said that your goal is the following one:

Now the issue is when I make some changes to my app and want to deploy that changes I have to stop/remove my-container and create a new one from new Docker image

Your Dockerfile looks certainly like that:

FROM microsoft/aspnetcore
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "myapp.dll"]

So, you just need to create a volume to export your workdir /app into the host filesystem, outside the container (use -v parameter with docker run). Then simply restart the container after having applied changes to your app.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.