Does the stack stack deploy dockers with local images

I am trying to use docker stack deployment to deploy a local node application. I have a terrible time when I get a good workflow.

I am confused with stack deployment and attitude towards docker hub. I'm glad I need to create the image locally, but clicking is a problem because my network is so slow and the image is 169 MB.

My question is: if I just create the image locally, should it deploy when deploying the docker stack? Or do I always have to publish a new image in the docker hub? nb It is currently published in a private repository.

Why am I asking? I tried to make a local docker build -t myname/myimage:latest and then redeployed by deploying the docker stack with docker-compose.yml , which refers to the image myname/myimage:latest , but another image reappears from 24 hours ago. even if I deleted it locally using docker rmi (again and again), And then the service does not start with errors that should be fixed in the new assembly.

I can only think that the container deployed when the stack is deployed is based on what is published in the docker hub, not the local image. Of course, the size of the image that continues to be displayed in docker images corresponds to the old image, which is currently in the docker hub, and not in the new one.

Perhaps I'm doing something wrong or misunderstanding how stack deployment works?

+5
source share
1 answer

You should try to create your local image this way:

docker build -t myimage.

and refer to it as "myimage: latest" in the compose file if you want to use a local image.

If you want to click it on the hub, first check it

docker tag id_of_myimage my_dockerhub_username / myimage: last

and then click.

docker push my_dockerhub_username / myimage: last

+1
source

Source: https://habr.com/ru/post/1266895/


All Articles