Using the ARGS with an IMAGE in docker-compose

Hello,

$ docker -v
Docker version 1.12.5, build 7392c3b

$ docker-compose -v
docker-compose version 1.9.0, build 2585387

I am experiencing a similar problem. I understand the solution expressed above but haven’t found the correct syntax to do so.

version: '2'
services:
  myApp:
    image: ourPrivate/dockerImage
    build:
      args:
        domain: myapp.dev
    container_name: my-app
    stdin_open: true
    tty: true
    ports:
      - "80:80"
      - "443:443"
      - "3306:3306"
    links:
      - db
    volumes:
      - .:/var/www/html

  db:
    image: "mysql:5"
    environment:
      MYSQL_ROOT_PASSWORD: blahblah
      MYSQL_DATABASE: blah_db

Our docker hub hosted image is expecting a build argument to set the domain in apache for a dev environment. I have tried using the context flag under build but then it looks for a local dockerFile. I need to pass the build args to the remote image that gets pulled down.

Receiving this error:

ERROR: The Compose file is invalid because:
Service myApp has neither an image nor a build context specified. At least one must be provided.

Thank you in advance!

1 Like