Docker Community Forums

Share and learn in the Docker community.

Is a Registry (local or remote) necessary to build a development system with Docker?

docker

(River2sea) #1

Is a Registry (local or remote) necessary to build a development system with Docker?
I have a system with several services/containers that use one shared data container. I use docker-compose to build/run my sysem. whenever I do a docker-compose build, the first container that depends on the shared container fails due to an error finding the image for the shared container.

Output with error:



Successfully built 28953289ac20
rabbitmq uses an image, skipping
mongodb uses an image, skipping
Building alert
Step 1 : FROM service
Pulling repository docker.io/library/service
ERROR: Service ‘alert’ failed to build: Error: image library/service not found

My docker-compose file:

Define an API gateway that maps calls to NGINX on port 80 to each of the

services that make up PKC, where each service is running on a different

port starting at 5001.

version: “2”

services:

nginx:
build: …/…/…/NGINX
restart: always
ports:
- "80:80"
links:
- registration
- alert
volumes:
- “…/…/…/NGINX/Configuration:/etc/nginx/conf.d”

PKC-API

service:
build: …/…/…/Service
restart: always
volumes:
- “…/…/…/Service/Library:/service/Library”

registration:
extends:
service: service
build: …/…/…/Registration
restart: always
ports:
- "5001:5000"
volumes:
- "…/…/…/Registration/Source:/service/Source"
links:
- mongodb:mongodb
- rabbitmq:rabbitmq

alert:
extends:
service: service
build: …/…/…/Alert
restart: always
ports:
- "5002:5000"
links:
- mongodb
- rabbitmq

PKC-Internal

mail:
extends:
service: service
build: …/…/…/Mail
restart: always
links:
- mongodb
- rabbitmq

notification:
extends:
service: service
restart: always
build: …/…/…/Notification
links:
- mongodb
- rabbitmq

Infrastructure

mongodb:
image: mongo
restart: always
ports:
- "27017:27017"
volumes:
- “/opt/pkc-db:/data/db”
- “…/…/…/PeaceKeeperCloud/Test:/Test”

TODO: Set up a volume on the docker host to hold the queue’s persistent messages.

rabbitmq:
restart: always
image: rabbitmq
#ports:
# - “5672:5672”


(Jeff Anderson) #2

You are specifying an image that doesn’t exist locally in your Dockerfile as a FROM. This will definitely need to be an image that either exists locally or can be pulled.


(River2sea) #3

Thanks Jeff. Can you expound on “exists locally”? What is the correct way to build the shared “service” image so that it can be found locally by dependent containers using “From service”?

Or am I required to at least have a local Registry that I push/pull to/from?

Thanks again for the help,
Rowland


(Jeff Anderson) #4

Any image that you have in your engine is a local image. See the output of docker images to see what images are there.

Images can get there in a few different ways: docker load, docker pull, docker tag, docker build.


(River2sea) #5

That make sense to me. I must be defining something wrong. When I build using the docker-compose.yml in my original post

$ docker-compose -f Docker/Development/docker-compose.yml build --force-rm --no-cache

The “service” image builds fine.

Then it proceeds to build the “alert” image and it fails to find the “service” image:

Building alert
Step 1 : FROM service
Pulling repository docker.io/library/service
ERROR: Service ‘alert’ failed to build: Error: image library/service not found

After this failure, these are the images I have locally. Note that all those “development_*” images are old and will be replaced if the build were to succeed:

REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
development_service        latest              07b086c76c7c        8 minutes ago       752.1 MB
<none>                     <none>              5d8c92185576        24 minutes ago      752.1 MB
development_mail           latest              e10a2ed75afa        14 hours ago        752.1 MB
development_nginx          latest              1a38170b8a3a        14 hours ago        182.8 MB
development_registration   latest              5958200d91cd        14 hours ago        752.1 MB
development_notification   latest              56254da4f807        14 hours ago        752.1 MB
development_alert          latest              3615cda8aaad        14 hours ago        752.1 MB
<none>                     <none>              17f9f353ef75        14 hours ago        752.1 MB
rabbitmq                   latest              510bf802c39d        4 days ago          175.9 MB
python                     3.5.1               7471c1ec292d        8 days ago          674.4 MB
mongo                      latest              a55d8a328b43        2 weeks ago         313.1 MB