I have three nodes swarm cluster - host01,host02,host03. host01 is manager.
Now I am in host01
test.yml
: version: '3'
services:
mongo:
image: ${PRIVATE_REGISTRY}/basin/mongo:3.0.15
restart: always
ports:
- 11081:27017
postgres:
image: ${PRIVATE_REGISTRY}/basin/postgres:10.1
restart: always
container_name: basin-postgres
${PRIVATE_REGISTRY}
: I publish registry on 5006, not 5000
[root@host01 scripts]# echo ${PRIVATE_REGISTRY}
host01:5006
basin/postgres 10.1 599272bf538f 5 weeks ago 287MB
basin/postgres latest 599272bf538f 5 weeks ago 287MB
host01:5006/basin/postgres 10.1 599272bf538f 5 weeks ago 287MB
host01:5006/basin/postgres latest 599272bf538f 5 weeks ago 287MB
basin/mongo 3.0.15 7312593938b8 7 weeks ago 233MB
basin/mongo latest 7312593938b8 7 weeks ago 233MB
host01:5006/basin/mongo 3.0.15 7312593938b8 7 weeks ago 233MB
host01:5006/basin/mongo latest 7312593938b8 7 weeks ago 233MB
basin/redis 3.2.11 d3f696a9f230 7 weeks ago 99.7MB
basin/redis latest d3f696a9f230 7 weeks ago 99.7MB
host01:5006/basin/redis 3.2.11 d3f696a9f230 7 weeks ago 99.7MB
host01:5006/basin/redis latest d3f696a9f230 7 weeks ago 99.7MB
host01:5006/basin/registry 2.6.2 a07e3f32a779 7 weeks ago 33.3MB
host01:5006/basin/registry latest a07e3f32a779 7 weeks ago 33.3MB
basin/registry 2.6.2 a07e3f32a779 7 weeks ago 33.3MB
basin/registry latest a07e3f32a779 7 weeks ago 33.3MB
/etc/docker/daemon.json
: [root@host01 scripts]# cat /etc/docker/daemon.json
{"registry-mirrors": ["http://host01:5006"], "insecure-registries" : [ "host01:5006"] }
docker-compose -f test.yml push
printed nothing, query registry showed nothing be pushed:
[root@host01 scripts]# curl -X GET http://${PRIVATE_REGISTRY}/v2/_catalog
{"repositories":[]}
But docker push ${PRIVATE_REGISTRY}/basin/mongo:3.0.15
worked.
If you look at the documentation for docker-compose push , there is written:
Pushes images for services to their respective registry/repository.
The following assumptions are made:
You are pushing an image you have built locally.
You have access to the build key.
Apparently, you can only push images with docker-compose push
that have a build:
section in their docker-compose.yml
file. Adding one solved the exact same problem for me.
It looks like you do not really have to build the image yourself - adding something like build: .
without ever building the image (and downloading it from the Docker Hub or a private registry instead) seems to work fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.