STACK DEPLOY Error response from daemon: rpc error: code = 3 desc = ContainerSpec: image reference must be provided

I am using this Docker file

FROM briddyes/weblogic:1.0

COPY HelloWorld.java /u01/oracle

RUN javac HelloWorld.java

ENTRYPOINT [“java”, “HelloWorld”]

I can run this with docker build and it will build it fine

but when I use this docker-compose yaml

version: “3.1”

services:
weblogic_svc:
build: .
networks:
- weblogic_net
ports:
- “7001:7001”

networks:
weblogic_net:

I would get this error

[root@docker-oct-2017-node-01 dockercoins]# docker stack deploy --compose-file docker-compose.yml testws
Ignoring unsupported options: build

Creating service testws_weblogic_svc
Error response from daemon: rpc error: code = 3 desc = ContainerSpec: image reference must be provided

any help would be appriciated

thanks !!!

it cannot build the image on the fly, you need to have a prebuild image already.

What happens if I don’t have a prebuilt image already? What do I do then?

Docker-compose, as a single-node multi-container orchestrator, is able to build images for its services, Swarm, as a mulit-node multi-container orchestrator, does not support that feature, as the image would be potententialy required on each node of the cluster.

The clean approach: either use pre-existing images from dockerhub, or create images and push them to dockerhub or a private registry. Then use this image in your swarm stack docker compose file.

The manual approach without a container registry:
Build the image on one of the nodes, save the image to a .tar file and load it into the other nodes. In an air-gapped environment, you typicaly save the images to a .tar and just load them into the docker engines in the air-gapped environment.

While the clean solution is resilient when images get purged, the second is not.