Reputation: 2282
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.
Upvotes: 3
Views: 167
Reputation: 4809
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.
Upvotes: 1