docker-compose base version as build attribute

As shown on in the official doc: and on this post: docker-compose 1.6 "args" attribute on "build", you can pass arguments from docker-compose to the build process.
But, I can’t figure out how to pass directly the base version. The Dockerfile must start with directive FROM, and your argument is available only after calling ARG your-arg-name.

Does anybody know of a solution to perform this? FROM ubuntu:$UBUNTU_VERSION?

  • apt-add-repository: command not found error in Dockerfile
  • Vagrant docker provisioner doesn't start containers on boot
  • Running a docker container to execute python script with minimal footprint
  • How does Docker run a Linux kernel under macOS host?
  • Docker cgroup options not working
  • Integration Tests with Docker and Bitbucket pipelines
  • Cheers,

  • Wrong type error on an interface intended to test a method using Docker's client API
  • GKE: Docker login alway succeeds, but push does not work even with valid credentials
  • docker run local script without host volumes
  • Docker containers experiencing socket issue (separate Flask + Nginx containers)
  • Must I create a tunnel to access a docker container on another host?
  • Docker exec printf gives No such file or directory error
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.