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.

  • Practically, what is the difference between docker run -dit vs docker run -d?
  • DockerHub not updating repository timestamp when updated repo pushed with same tag
  • how does docker net=host handle port conflict
  • Unable to connect to SQL Server Express container on host VM
  • Micro-components architecture with python / Django / Drf
  • dockerized HAProxy+Keepalived for HA
  • 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)

  • Deploying multi-docker local setup to AWS using Elastic Beanstalk
  • Docker push to AWS ECR fails on Windows: no basic auth credentials
  • Running docker commands as a build step in Jenkins
  • Salt minion inside docker container?
  • Can docker be used to run a web site container that first downloads latest version prior to running web server?
  • Run elasticsearch with docker
  • 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.