Skip to main content

A docker-compose alternative that actually behaves like standalone docker

Project description

ffs-docker-compose

Ever been frustrated by the slight variation in behavior between docker, docker compose, and docker-compose? So have I!

This package maps some of docker-compose's keys into docker CLI arguments and flags, guaranteeing identical behavior between single docker containers run from the command line, and container orchestrations kicked off from a docker-compose.yml file.

Just run ffs-docker-compose.py on your existing docker-compose.yml file!

Contents

Usage

$ ./ffs-docker-compose.py --help

usage: ffs-docker-compose [-h] [-d] [compose_file] {up,down,pull}

A version of docker-compose that maps docker-compose file parameters to actual docker arguments. A subset of docker-compose parameters are supported. When running in detached mode, the containers are automatically started on boot
via systemd.

positional arguments:
  compose_file    docker-compose.yml file. Only a subset of docker-compose params are actually read from the file.
  {up,down,pull}       start containers | stop & remove containers | pull latest image

options:
  -h, --help      show this help message and exit
  -d, --detached  Run containers in a detached state. Containers are automatically started on boot by systemd.

Because ffs docker-compose, why don't you behave like docker?!

Examples

Using the provided example docker-compose.yml file, simply run ./ffs-docker-compose.py up -d in the same directory as the YAML file.

Start containers in background

# Start the containers in the background
$ ./ffs-docker-compose.py up -d
~~~~ ffs-docker-compose || v1.0 ~~~~
Starting container micro-ros-agent in the background
Starting container tts in the background
[sudo] password for corey: 
done
$

Stop containers (even in background)

# Stop the containers
$ ./ffs-docker-compose.py down
~~~~ ffs-docker-compose || v1.0 ~~~~
Stopping & removing container micro-ros-agent
Stopping & removing container tts
done
$

Start containers in the foreground

# Start the containers in the foreground
$ ./ffs-docker-compose.py up
~~~~ ffs-docker-compose || v1.0 ~~~~
Starting container micro-ros-agent
Starting container tts
Waiting for containers to exit, press CTRL-c to kill containers...
[1712035918.379127] info     | UDPv4AgentLinux.cpp | init                     | running...             | port: 8888
[1712035918.397009] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 4
/parameter_events
/rosout
Package 'tts' not found
Restarting container tts...
/parameter_events
/rosout
Package 'tts' not found
Restarting container tts...
^CCaught ctrl-c, killing containers...
micro-ros-agent
tts
done
$

Compatibility

Converting an existing docker-compose.yml file for use with ffs-docker-compose

docker-compose (v1) and docker compose (v2+) YAML files are supported, as this script simply maps the YAML keys into docker flags and CLI arguments.

However, you must modify the version tag at the top of your docker-compose.yml file to include the text ffs to acknowledge the limitations of running ffs-docker-compose on a docker-compose.yml file.

List of compatible docker-compose YAML keys

Key Supported?
image yes
container_name yes
command yes
entrypoint yes*
restart yes**

*entrypoint has the same behavior as command

**restart only accepts the always value and defaults to never

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffs_docker_compose-1.0.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

ffs_docker_compose-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file ffs_docker_compose-1.0.0.tar.gz.

File metadata

  • Download URL: ffs_docker_compose-1.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for ffs_docker_compose-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7f3d248f97aeed9eb30b9a25029c03ec76468542ed1ac45748f4967a029f2fc9
MD5 377c81bd14140dcf3e9eba509313c274
BLAKE2b-256 bf5e79bebf46cb0cfd66af8b8e0bd90815578c1978ce2b7e3e1c6eaba158e865

See more details on using hashes here.

File details

Details for the file ffs_docker_compose-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ffs_docker_compose-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb75d903c04f8b2b9088b65de7f8444422d3f69a494550827628ae3ea2452cc5
MD5 3383bf1dfc9db4eacbd0a0abdbd7c462
BLAKE2b-256 72358b954317a49de66e1ba7e2a10d1720319c767ef739b03d41df5659a70343

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page