Like “make” for Docker

I am working add wrapping my application in a docker container, which leads my to type some pretty verbose commands pretty often:

sudo docker build -t foo/bar .
sudo docker run foo/bar /bin/bash /path/to/my/script/test_report.sh
...

I want some way to wrap these in a script, making them easier to execute, and letting me forget the details between runs.

  • Can I use Docker Compose to provision Vagrant directly?
  • Best practice for docker webserver, muliple layers or single layer?
  • Docker container running but browser refuse to connect
  • How to open multiple terminals in docker?
  • Cloudfront returning 502 errors
  • ZeroMQ fails to .bind() on Docker on [0.0.0.0:5555] - address already in use. Why?
  • Make does this pretty well. Instructions can be wrapped together, so I can do make test, make run, make deploy or whatever.

    I suppose there is nothing stopping me from just using make, but is there a more modern solution, that doesn’t break when I use spaces instead of tabs and is just more pleasant to work with?

    My project is Python, but I am looking for a generic solution. Preferably one that lets me wrap bash scripts (since that allows me infinite flexibility)

  • Command to Copy/share jmeter master container results (Docker) generated in by running the script in non-gui mode to EC2 instance
  • All images and containers disappeared after host kernel downgrade
  • Debug PHP cli application inside docker with PhpStorm
  • Spring boot with docker unable to find valid certification path to requested target error
  • Tensorflow for Poets | Relaunching Docker | invalid reference format
  • Manifest invalid error while pushing an image in bluemix
  • 2 Solutions collect form web for “Like “make” for Docker”

    Take a look at docker-compose.

    If you create the following docker-compose.yml file in the same folder as your Dockerfile:

    foobar:
        build: .
        command: /bin/bash /path/to/my/script/test_report.sh
    

    you can then build with: docker-compose build

    and start a new container with :docker-compose up


    What’s interesting with Docker compose is that you can define in the compose file anything related to the docker run command such as volumes, published ports, etc.

    For more info take a look at the Docker compose documentation and file reference.

    dobi is designed to be exactly that tool. A “build automation” tool that uses containers for all the tasks. Everything is configured in a yaml file, and you can run tasks like you would with make: dobi <task>

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