How can I pass build args with a remote image in docker-compose.yml?

I would like to pull a remote image from a private registry. The image’s dockerfile contains some args whose values would be populated via docker-compose.yml. For example:

version: '3.0'

        image: remoteApiImage
        image: remoteWebImage
                baseurl: http://remoteApiImage:80

Currently, this does not work as build requires a context. However, if I set a context, it expects a local Dockerfile. Even setting to . without a local Dockerfile will pull the remote image, but the build args are not passed properly.

  • Docker ELK 5.4.0 - Kibana did not load properly. Check the server output for more information
  • How to update a Docker container from a newer image?
  • How to provide parameter to docker run with “oc new-app” in OpenShift?
  • How to set busybox vi auto wrap when a line too long?
  • How should I create Dockerfile to run multiple services through docker-compose?
  • Is SBT 0.13.5 supported on Docker/Dokku images?
  • Is this possible?

    Note: I am using Windows Server 2016 containers. Not sure that is relevant to the issue.

  • Unable to connect with container running in multiple host (Destination Host unreachable) [closed]
  • What are the differences between Kubernetes Pods and Docker Compose(s) (Composures?)
  • npm not working after export MSYS_NO_PATHCONV on Git Bash
  • Unable to attach to Docker container: “.: .: is a directory”
  • Docker: Swarm worker nodes not finding locally built image
  • Specifying Docker daemon host in Elastic Beanstalk
  • One Solution collect form web for “How can I pass build args with a remote image in docker-compose.yml?”

    As johnharris85 comment suggests, what you are trying to do is not possible. You cannot pull and image and then rebuild it (without the Dockerfile).

    If you are trying to specify arguments to an image then you would d this via environment variables. Otherwise, if you have the sources Dockerfile for the image, you can use the ARG function to specify arguments while rebuilding it yourself.

    build and image in the docker-compose.yml context are mutually exclusive.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.