forked from extern/podman-compose
Compare commits
153 Commits
Author | SHA1 | Date | |
---|---|---|---|
e9b103eb23 | |||
bbaa786739 | |||
d1d0f9e452 | |||
d8dba61e08 | |||
3343910763 | |||
34ec4b3cb9 | |||
f4a78ae812 | |||
00b9ce1ee4 | |||
749d188321 | |||
e879529976 | |||
1555417958 | |||
1f989ed133 | |||
66ce2a34f5 | |||
d8e11d59ef | |||
72c3572123 | |||
c187e88eaf | |||
31b8bb477d | |||
f177712585 | |||
ae3deb19dc | |||
117b7fbb9e | |||
5acb9978eb | |||
02b2f6585d | |||
a36b6f1feb | |||
e3be6dd511 | |||
4b756786f3 | |||
dcb038ef3a | |||
a2fef56b07 | |||
c753b8e2cf | |||
c9486c9f3b | |||
f2aeaba0d6 | |||
2d80e435dd | |||
d1a77defcd | |||
c49f0700c8 | |||
6d69b7c74c | |||
ab135030c8 | |||
069018c5b1 | |||
b33c42b7e2 | |||
785f7ad8a3 | |||
b6a9f8efd4 | |||
4a5fd23a2e | |||
dc0ac0d03c | |||
502d7cc206 | |||
e85d79d4f4 | |||
bfb57b9ba2 | |||
2d0aad6692 | |||
ff5b9f1663 | |||
62aa337f17 | |||
3836094c64 | |||
d97a20d563 | |||
f417c9ab8c | |||
5ed5528294 | |||
3d6ca3c204 | |||
6e3383de72 | |||
8ef7587aa1 | |||
039fe30a70 | |||
62d2024fee | |||
9317f987fc | |||
045cef299b | |||
a7f97b6120 | |||
0ea18b4419 | |||
905914b0dc | |||
00840d0613 | |||
2ad7daa81f | |||
080b8a369e | |||
226ac4fb3a | |||
030a196102 | |||
901213e5b3 | |||
b3370603d9 | |||
b3090c3c3a | |||
5fabfee497 | |||
75a63df954 | |||
08dd36f4c1 | |||
669953b3d3 | |||
d3df688aee | |||
bda7b5e812 | |||
6289d25a42 | |||
abc08135ba | |||
9cd837f01d | |||
a4b8b5e709 | |||
5971f57130 | |||
ab96f12dba | |||
f6a3cb0aff | |||
497355fcfb | |||
20a86ea563 | |||
4e2e960106 | |||
efba3a1380 | |||
90639769f0 | |||
3712b545a9 | |||
294f8ee37b | |||
105b129b08 | |||
d3f37112a7 | |||
7eacf14693 | |||
8cd98ab708 | |||
047820dbf1 | |||
e7b1382b1b | |||
64ed554543 | |||
0ac75fd361 | |||
93bf39e9e2 | |||
5915ba345f | |||
1ca6a88ebd | |||
7b40079c06 | |||
f9915c47b4 | |||
19733407b4 | |||
e8147e350b | |||
7f210ffc43 | |||
cbed801c0d | |||
6a42d6861d | |||
07a2430c41 | |||
5215782cba | |||
80e7ba188d | |||
03cbd2929b | |||
796e6a4473 | |||
efcbc75f63 | |||
dacc7538ec | |||
8c3b7e6c54 | |||
147f0ae42f | |||
27d3cafb7b | |||
e7a9bd3b70 | |||
ddd582c861 | |||
169eaee9b2 | |||
c5f8973bd5 | |||
12036aa54e | |||
0fc864ffbe | |||
7222fdb6e7 | |||
bb7120f3ff | |||
7ebbe2efc6 | |||
29d4cdc9ab | |||
a9216c3980 | |||
e538852dbe | |||
b1c2b0222b | |||
9e0dd2da9d | |||
72c1992737 | |||
3e2381f040 | |||
dee813a4b6 | |||
9684429157 | |||
87e7211ade | |||
72697016f9 | |||
b369073574 | |||
62f0cc492c | |||
c152d28af7 | |||
8e43e69c5b | |||
4c07e875a0 | |||
751aaa87f6 | |||
243bdb688d | |||
d9cd0d6186 | |||
ec06da2265 | |||
2202e7f39b | |||
f505e499a2 | |||
813dc8b149 | |||
6f2e5de57c | |||
2e4378f7ad | |||
2a8d430c92 | |||
a512c0cb82 |
54
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
54
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
Please make sure it's not a bug in podman (in that case report it to podman)
|
||||||
|
or your understanding of docker-compose or how rootless containers work (for example, it's normal for rootless container not to be able to listen for port less than 1024 like 80)
|
||||||
|
|
||||||
|
please try to reproduce the bug in latest devel branch
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. what is the content of the current working directory (ex. `docker-compose.yml`, `.env`, `Dockerfile`, ...etc.)
|
||||||
|
2. what is the sequence of commands you typed
|
||||||
|
|
||||||
|
please use [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) for example give me a small busybox-based compose yaml
|
||||||
|
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Actual behavior**
|
||||||
|
What is the behavior you actually got and that should not happen.
|
||||||
|
|
||||||
|
|
||||||
|
**Output**
|
||||||
|
|
||||||
|
```
|
||||||
|
$ podman-compose version
|
||||||
|
using podman version: 3.4.0
|
||||||
|
podman-composer version 0.1.7dev
|
||||||
|
podman --version
|
||||||
|
podman version 3.4.0
|
||||||
|
|
||||||
|
$ podman-compose up
|
||||||
|
...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**Environment:**
|
||||||
|
- OS: Linux / WSL / Mac
|
||||||
|
- podman version:
|
||||||
|
- podman compose version: (git hex)
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
|
||||||
|
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
3
CODE-OF-CONDUCT.md
Normal file
3
CODE-OF-CONDUCT.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## The Podman Compose Project Community Code of Conduct
|
||||||
|
|
||||||
|
The Podman Compose project follows the [Containers Community Code of Conduct](https://github.com/containers/common/blob/master/CODE-OF-CONDUCT.md).
|
@ -54,12 +54,11 @@ def compose_up(compose, args):
|
|||||||
|
|
||||||
|
|
||||||
## Missing Commands (help needed)
|
## Missing Commands (help needed)
|
||||||
|
```
|
||||||
bundle Generate a Docker bundle from the Compose file
|
bundle Generate a Docker bundle from the Compose file
|
||||||
config Validate and view the Compose file
|
config Validate and view the Compose file
|
||||||
create Create services
|
create Create services
|
||||||
events Receive real time events from containers
|
events Receive real time events from containers
|
||||||
exec Execute a command in a running container
|
|
||||||
images List images
|
images List images
|
||||||
kill Kill containers
|
kill Kill containers
|
||||||
logs View output from containers
|
logs View output from containers
|
||||||
@ -72,3 +71,4 @@ def compose_up(compose, args):
|
|||||||
top Display the running processes
|
top Display the running processes
|
||||||
unpause Unpause services
|
unpause Unpause services
|
||||||
version Show the Docker-Compose version information
|
version Show the Docker-Compose version information
|
||||||
|
```
|
||||||
|
26
README.md
26
README.md
@ -1,15 +1,24 @@
|
|||||||
# Podman Compose
|
# Podman Compose
|
||||||
|
|
||||||
An implementation of `docker-compose` with [podman](https://podman.io/) backend.
|
An implementation of `docker-compose` with [Podman](https://podman.io/) backend.
|
||||||
The main objective of this project is to be able to run `docker-compose.yml` unmodified and rootless.
|
The main objective of this project is to be able to run `docker-compose.yml` unmodified and rootless.
|
||||||
This project is aimed to provide drop-in replacement for `docker-compose`,
|
This project is aimed to provide drop-in replacement for `docker-compose`,
|
||||||
and it's very useful for certain cases because:
|
and it's very useful for certain cases because:
|
||||||
|
|
||||||
- can run rootless
|
- can run rootless
|
||||||
- only depend on `podman` and Python3 and [PyYAML](https://pyyaml.org/)
|
|
||||||
- no daemon, no setup.
|
- no daemon, no setup.
|
||||||
- can be used by developers to run single-machine containerized stacks using single familiar YAML file
|
- can be used by developers to run single-machine containerized stacks using single familiar YAML file
|
||||||
|
|
||||||
|
This project only depend on:
|
||||||
|
|
||||||
|
* `podman`
|
||||||
|
* Python3
|
||||||
|
* [PyYAML](https://pyyaml.org/)
|
||||||
|
* [python-dotenv](https://pypi.org/project/python-dotenv/)
|
||||||
|
|
||||||
|
And it's formed as a single python file script that you can drop into your PATH and run.
|
||||||
|
|
||||||
|
|
||||||
For production-like single-machine containerized environment consider
|
For production-like single-machine containerized environment consider
|
||||||
|
|
||||||
- [k3s](https://k3s.io) | [k3s github](https://github.com/rancher/k3s)
|
- [k3s](https://k3s.io) | [k3s github](https://github.com/rancher/k3s)
|
||||||
@ -20,9 +29,12 @@ For production-like single-machine containerized environment consider
|
|||||||
For the real thing (multi-node clusters) check any production
|
For the real thing (multi-node clusters) check any production
|
||||||
OpenShift/Kubernetes distribution like [OKD](https://www.okd.io/minishift/).
|
OpenShift/Kubernetes distribution like [OKD](https://www.okd.io/minishift/).
|
||||||
|
|
||||||
## NOTE
|
## Versions
|
||||||
|
|
||||||
This project is still underdevelopment.
|
If you have legacy version of `podman` (before 3.x) you might need to stick with legacy `podman-compose` `0.1.x` branch.
|
||||||
|
The legacy branch 0.1.x uses mappings and workarounds to compensate for rootless limitations.
|
||||||
|
|
||||||
|
Modern podman versions (>=3.4) do not have those limitations and thus you can use latest and stable 1.x branch.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -54,6 +66,12 @@ curl -o ~/.local/bin/podman-compose https://raw.githubusercontent.com/containers
|
|||||||
chmod +x ~/.local/bin/podman-compose
|
chmod +x ~/.local/bin/podman-compose
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or install from Fedora (starting from f31) repositories:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo dnf install podman-compose
|
||||||
|
```
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
We have included fully functional sample stacks inside `examples/` directory.
|
We have included fully functional sample stacks inside `examples/` directory.
|
||||||
|
3
SECURITY.md
Normal file
3
SECURITY.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## Security and Disclosure Information Policy for the Podman Compose Project
|
||||||
|
|
||||||
|
The Podman Compose Project follows the [Security and Disclosure Information Policy](https://github.com/containers/common/blob/master/SECURITY.md) for the Containers Projects.
|
1284
podman_compose.py
1284
podman_compose.py
File diff suppressed because it is too large
Load Diff
7
requirements.txt
Normal file
7
requirements.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
pyyaml
|
||||||
|
python-dotenv
|
||||||
|
|
@ -1,2 +1,5 @@
|
|||||||
[bdist_wheel]
|
[bdist_wheel]
|
||||||
universal = 1
|
universal = 1
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
version = attr: podman_compose.__version__
|
||||||
|
10
setup.py
10
setup.py
@ -1,23 +1,18 @@
|
|||||||
import os
|
import os
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup
|
||||||
|
|
||||||
try:
|
try:
|
||||||
readme = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
|
readme = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
|
||||||
except:
|
except:
|
||||||
readme = ''
|
readme = ''
|
||||||
|
|
||||||
from podman_compose import __version__ as podman_compose_version
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='podman-compose',
|
name='podman-compose',
|
||||||
version=podman_compose_version,
|
|
||||||
description="A script to run docker-compose.yml using podman",
|
description="A script to run docker-compose.yml using podman",
|
||||||
long_description=readme,
|
long_description=readme,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 2",
|
|
||||||
"Programming Language :: Python :: 2.7",
|
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.5",
|
"Programming Language :: Python :: 3.5",
|
||||||
"Programming Language :: Python :: 3.6",
|
"Programming Language :: Python :: 3.6",
|
||||||
@ -41,7 +36,8 @@ setup(
|
|||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
license='GPL-2.0-only',
|
license='GPL-2.0-only',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'pyyaml'
|
'pyyaml',
|
||||||
|
'python-dotenv',
|
||||||
],
|
],
|
||||||
# test_suite='tests',
|
# test_suite='tests',
|
||||||
# tests_require=[
|
# tests_require=[
|
||||||
|
8
test-requirements.txt
Normal file
8
test-requirements.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
coverage
|
||||||
|
pytest-cov
|
||||||
|
pytest
|
||||||
|
tox
|
@ -1,7 +1,9 @@
|
|||||||
FROM busybox
|
FROM busybox
|
||||||
ARG buildno=1
|
ARG buildno=1
|
||||||
ARG httpd_port=80
|
ARG httpd_port=80
|
||||||
|
ARG other_variable=not_set
|
||||||
ENV httpd_port ${httpd_port}
|
ENV httpd_port ${httpd_port}
|
||||||
|
ENV other_variable ${other_variable}
|
||||||
RUN mkdir -p /var/www/html/ && \
|
RUN mkdir -p /var/www/html/ && \
|
||||||
echo "ALT buildno=$buildno port=$httpd_port `date -Iseconds`" > /var/www/html/index.txt
|
echo "ALT buildno=$buildno port=$httpd_port `date -Iseconds`" > /var/www/html/index.txt
|
||||||
CMD httpd -f -p "$httpd_port" -h /var/www/html
|
CMD httpd -f -p "$httpd_port" -h /var/www/html
|
||||||
|
@ -17,3 +17,9 @@ services:
|
|||||||
image: my-busybox-httpd2
|
image: my-busybox-httpd2
|
||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- 8000:8000
|
||||||
|
test_build_arg_argument:
|
||||||
|
build:
|
||||||
|
context: ./context
|
||||||
|
dockerfile: Dockerfile-alt
|
||||||
|
image: my-busybox-httpd2
|
||||||
|
command: env
|
||||||
|
4
tests/deps/README.md
Normal file
4
tests/deps/README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
```
|
||||||
|
podman-compose run --rm sleep /bin/sh -c 'wget -O - http://localhost:8000/hosts'
|
||||||
|
```
|
24
tests/deps/docker-compose.yaml
Normal file
24
tests/deps/docker-compose.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "httpd", "-f", "-h", "/etc/", "-p", "8000"]
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
sleep:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "sleep 3600"]
|
||||||
|
depends_on: "web"
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
sleep2:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "sleep 3600"]
|
||||||
|
depends_on:
|
||||||
|
- sleep
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
|
5
tests/env-tests/README.md
Normal file
5
tests/env-tests/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
running the following command should give myval2
|
||||||
|
|
||||||
|
```
|
||||||
|
podman_compose run -l monkey -e ZZVAR1=myval2 env-test
|
||||||
|
```
|
9
tests/env-tests/container-compose.yml
Normal file
9
tests/env-tests/container-compose.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
env-test:
|
||||||
|
image: busybox
|
||||||
|
command: sh -c "export | grep ZZ"
|
||||||
|
environment:
|
||||||
|
- ZZVAR1=myval1
|
||||||
|
|
15
tests/exit-from/README.md
Normal file
15
tests/exit-from/README.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
We have service named sh1 that exits with code 1 and sh2 that exists with code 2
|
||||||
|
|
||||||
|
```
|
||||||
|
podman-compose up --exit-code-from=sh1
|
||||||
|
echo $?
|
||||||
|
```
|
||||||
|
|
||||||
|
the above should give 1.
|
||||||
|
|
||||||
|
```
|
||||||
|
podman-compose up --exit-code-from=sh2
|
||||||
|
echo $?
|
||||||
|
```
|
||||||
|
|
||||||
|
the above should give 2.
|
21
tests/exit-from/docker-compose.yaml
Normal file
21
tests/exit-from/docker-compose.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
too_long:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "sleep 3600; exit 0"]
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
sh1:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "sleep 5; exit 1"]
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
sh2:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "sleep 5; exit 2"]
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
|
29
tests/extends/docker-compose.yaml
Normal file
29
tests/extends/docker-compose.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
echo:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "echo", "Zero"]
|
||||||
|
ports:
|
||||||
|
- '1234:1234'
|
||||||
|
environment:
|
||||||
|
- FOO=original
|
||||||
|
- BAR=original
|
||||||
|
# volumes:
|
||||||
|
# - ./original:/foo
|
||||||
|
# - ./original:/bar
|
||||||
|
echo1:
|
||||||
|
extends:
|
||||||
|
service: echo
|
||||||
|
command: ["/bin/busybox", "echo", "One"]
|
||||||
|
ports:
|
||||||
|
- '12345:12345'
|
||||||
|
# volumes:
|
||||||
|
# - ./local:/bar
|
||||||
|
# - ./local:/baz
|
||||||
|
env1:
|
||||||
|
extends:
|
||||||
|
service: echo
|
||||||
|
command: ["/bin/busybox", "env"]
|
||||||
|
environment:
|
||||||
|
- BAR=local
|
||||||
|
- BAZ=local
|
7
tests/extends_w_file/common-services.yml
Normal file
7
tests/extends_w_file/common-services.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
webapp:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- "/data"
|
||||||
|
|
14
tests/extends_w_file/docker-compose.yml
Normal file
14
tests/extends_w_file/docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
extends:
|
||||||
|
file: common-services.yml
|
||||||
|
service: webapp
|
||||||
|
environment:
|
||||||
|
- DEBUG=1
|
||||||
|
cpu_shares: 5
|
||||||
|
|
||||||
|
important_web:
|
||||||
|
extends: web
|
||||||
|
cpu_shares: 10
|
||||||
|
|
1
tests/interpolation/.env
Normal file
1
tests/interpolation/.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
DOT_ENV_VARIABLE=This value is from the .env file
|
@ -0,0 +1,8 @@
|
|||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
variables:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"]
|
||||||
|
environment:
|
||||||
|
EXAMPLE_COLON_QUESTION_ERROR: ${NOT_A_VARIABLE:?Missing variable}
|
||||||
|
|
8
tests/interpolation/docker-compose-question-error.yml
Normal file
8
tests/interpolation/docker-compose-question-error.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
variables:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"]
|
||||||
|
environment:
|
||||||
|
EXAMPLE_QUESTION_ERROR: ${NOT_A_VARIABLE?Missing variable}
|
||||||
|
|
14
tests/interpolation/docker-compose.yml
Normal file
14
tests/interpolation/docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
variables:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"]
|
||||||
|
environment:
|
||||||
|
EXAMPLE_VARIABLE: "Host user: $USER"
|
||||||
|
EXAMPLE_BRACES: "Host user: ${USER}"
|
||||||
|
EXAMPLE_COLON_DASH_DEFAULT: ${NOT_A_VARIABLE:-My default}
|
||||||
|
EXAMPLE_DASH_DEFAULT: ${NOT_A_VARIABLE-My other default}
|
||||||
|
EXAMPLE_DOT_ENV: $DOT_ENV_VARIABLE
|
||||||
|
EXAMPLE_LITERAL: This is a $$literal
|
||||||
|
EXAMPLE_EMPTY: $NOT_A_VARIABLE
|
||||||
|
|
19
tests/multicompose/README.md
Normal file
19
tests/multicompose/README.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Multiple compose files
|
||||||
|
|
||||||
|
to make sure we get results similar to
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose -f d1/docker-compose.yml -f d2/docker-compose.yml up -d
|
||||||
|
docker exec -ti d1_web1_1 sh -c 'set'
|
||||||
|
docker exec -ti d1_web2_1 sh -c 'set'
|
||||||
|
curl http://${d1_web1_1}:8001/index.txt
|
||||||
|
curl http://${d1_web1_1}:8002/index.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
we need to verify
|
||||||
|
|
||||||
|
- project base directory and project name is `d1`
|
||||||
|
- `var12='d1/12.env'` which means `enf_file` was appended not replaced (which means that we normalize to array before merge)
|
||||||
|
- `var2='d1/2.env'` which means that paths inside `d2/docker-compose.yml` directory are relative to `d1`
|
||||||
|
|
||||||
|
|
1
tests/multicompose/d1/1.env
Normal file
1
tests/multicompose/d1/1.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
var1=d1/1.env
|
1
tests/multicompose/d1/12.env
Normal file
1
tests/multicompose/d1/12.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
var12=d1/12.env
|
1
tests/multicompose/d1/2.env
Normal file
1
tests/multicompose/d1/2.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
var2=d1/2.env
|
13
tests/multicompose/d1/docker-compose.yml
Normal file
13
tests/multicompose/d1/docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
web1:
|
||||||
|
image: busybox
|
||||||
|
command: busybox httpd -h /var/www/html/ -f -p 8001
|
||||||
|
volumes:
|
||||||
|
- ./1.env:/var/www/html/index.txt
|
||||||
|
env_file: ./1.env
|
||||||
|
labels:
|
||||||
|
l1: v1
|
||||||
|
environment:
|
||||||
|
- mykey1=myval1
|
||||||
|
|
1
tests/multicompose/d2/12.env
Normal file
1
tests/multicompose/d2/12.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
var12=d2/12.env
|
1
tests/multicompose/d2/2.env
Normal file
1
tests/multicompose/d2/2.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
var2=d2/2.env
|
18
tests/multicompose/d2/docker-compose.yml
Normal file
18
tests/multicompose/d2/docker-compose.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
web1:
|
||||||
|
env_file: ./12.env
|
||||||
|
labels:
|
||||||
|
- l1=v2
|
||||||
|
- l2=v2
|
||||||
|
environment:
|
||||||
|
mykey1: myval2
|
||||||
|
mykey2: myval2
|
||||||
|
|
||||||
|
web2:
|
||||||
|
image: busybox
|
||||||
|
command: busybox httpd -h /var/www/html/ -f -p 8002
|
||||||
|
volumes:
|
||||||
|
- ./2.env:/var/www/html/index.txt
|
||||||
|
env_file: ./2.env
|
||||||
|
|
7
tests/no_services/docker-compose.yaml
Normal file
7
tests/no_services/docker-compose.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
version: '3'
|
||||||
|
networks:
|
||||||
|
shared-network:
|
||||||
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 172.19.0.0/24
|
33
tests/ports/docker-compose.yml
Normal file
33
tests/ports/docker-compose.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
web1:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "httpd", "-f", "-h", "/var/www/html", "-p", "8001"]
|
||||||
|
working_dir: /var/www/html
|
||||||
|
ports:
|
||||||
|
- 8001:8001
|
||||||
|
volumes:
|
||||||
|
- ./test1.txt:/var/www/html/index.txt:ro
|
||||||
|
web2:
|
||||||
|
image: busybox
|
||||||
|
command: ["/bin/busybox", "httpd", "-f", "-h", "/var/www/html", "-p", "8002"]
|
||||||
|
working_dir: /var/www/html
|
||||||
|
ports:
|
||||||
|
- 8002:8002
|
||||||
|
- target: 8003
|
||||||
|
host_ip: 127.0.0.1
|
||||||
|
published: 8003
|
||||||
|
protocol: udp
|
||||||
|
- target: 8004
|
||||||
|
host_ip: 127.0.0.1
|
||||||
|
published: 8004
|
||||||
|
protocol: tcp
|
||||||
|
- target: 8005
|
||||||
|
published: 8005
|
||||||
|
- target: 8006
|
||||||
|
protocol: udp
|
||||||
|
- target: 8007
|
||||||
|
host_ip: 127.0.0.1
|
||||||
|
volumes:
|
||||||
|
- ./test2.txt:/var/www/html/index.txt:ro
|
||||||
|
|
1
tests/ports/test1.txt
Normal file
1
tests/ports/test1.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
test1
|
1
tests/ports/test2.txt
Normal file
1
tests/ports/test2.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
test2
|
12
tests/seccomp/docker-compose.yml
Normal file
12
tests/seccomp/docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
web1:
|
||||||
|
image: busybox
|
||||||
|
command: httpd -f -p 80 -h /var/www/html
|
||||||
|
volumes:
|
||||||
|
- ./docker-compose.yml:/var/www/html/index.html
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
security_opt:
|
||||||
|
- seccomp:unconfined
|
||||||
|
|
18
tests/secrets/bad_external_name/docker-compose.yaml
Normal file
18
tests/secrets/bad_external_name/docker-compose.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
test:
|
||||||
|
image: busybox
|
||||||
|
command:
|
||||||
|
- cat
|
||||||
|
- /run/secrets/new_secret
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
secrets:
|
||||||
|
- new_secret
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
new_secret:
|
||||||
|
external: true
|
||||||
|
name: my_secret
|
||||||
|
|
18
tests/secrets/bad_external_target/docker-compose.yaml
Normal file
18
tests/secrets/bad_external_target/docker-compose.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
test:
|
||||||
|
image: busybox
|
||||||
|
command:
|
||||||
|
- cat
|
||||||
|
- /run/secrets/my_secret_2
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
secrets:
|
||||||
|
- source: my_secret
|
||||||
|
target: new_secret
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
my_secret:
|
||||||
|
external: true
|
||||||
|
|
42
tests/secrets/docker-compose.yaml
Normal file
42
tests/secrets/docker-compose.yaml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
test:
|
||||||
|
image: busybox
|
||||||
|
command:
|
||||||
|
- /tmp/print_secrets.sh
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
- /tmp
|
||||||
|
volumes:
|
||||||
|
- ./print_secrets.sh:/tmp/print_secrets.sh
|
||||||
|
secrets:
|
||||||
|
- my_secret
|
||||||
|
- my_secret_2
|
||||||
|
- source: my_secret_3
|
||||||
|
target: my_secret_3
|
||||||
|
uid: '103'
|
||||||
|
gid: '103'
|
||||||
|
mode: 400
|
||||||
|
- file_secret
|
||||||
|
- source: file_secret
|
||||||
|
target: custom_name
|
||||||
|
- source: file_secret
|
||||||
|
target: /etc/custom_location
|
||||||
|
- source: file_secret
|
||||||
|
target: unused_params_warning
|
||||||
|
uid: '103'
|
||||||
|
gid: '103'
|
||||||
|
mode: 400
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
my_secret:
|
||||||
|
external: true
|
||||||
|
my_secret_2:
|
||||||
|
external: true
|
||||||
|
name: my_secret_2
|
||||||
|
my_secret_3:
|
||||||
|
external: true
|
||||||
|
name: my_secret_3
|
||||||
|
file_secret:
|
||||||
|
file: ./my_secret
|
||||||
|
|
1
tests/secrets/my_secret
Normal file
1
tests/secrets/my_secret
Normal file
@ -0,0 +1 @@
|
|||||||
|
important-secret-is-important
|
6
tests/secrets/print_secrets.sh
Executable file
6
tests/secrets/print_secrets.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
ls -la /run/secrets/*
|
||||||
|
ls -la /etc/custom_location
|
||||||
|
cat /run/secrets/*
|
||||||
|
cat /etc/custom_location
|
3
tests/ulimit/Dockerfile
Normal file
3
tests/ulimit/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM busybox
|
||||||
|
|
||||||
|
COPY ./ulimit.sh /bin/ulimit.sh
|
30
tests/ulimit/docker-compose.yaml
Normal file
30
tests/ulimit/docker-compose.yaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
ulimit1:
|
||||||
|
image: ulimit_test
|
||||||
|
command: ["ulimit.sh" ]
|
||||||
|
ulimits: nofile=1001
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ulimit2:
|
||||||
|
image: ulimit_test
|
||||||
|
command: ["ulimit.sh" ]
|
||||||
|
ulimits:
|
||||||
|
- nproc=1002:2002
|
||||||
|
- nofile=1002
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ulimit3:
|
||||||
|
image: ulimit_test
|
||||||
|
command: [ "ulimit.sh" ]
|
||||||
|
ulimits:
|
||||||
|
nofile: 1003
|
||||||
|
nproc:
|
||||||
|
soft: 1003
|
||||||
|
hard: 2003
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
|
10
tests/ulimit/ulimit.sh
Executable file
10
tests/ulimit/ulimit.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "soft process limit"
|
||||||
|
ulimit -S -u
|
||||||
|
echo "hard process limit"
|
||||||
|
ulimit -H -u
|
||||||
|
echo "soft nofile limit"
|
||||||
|
ulimit -S -n
|
||||||
|
echo "hard nofile limit"
|
||||||
|
ulimit -H -n
|
8
tests/vol/README.md
Normal file
8
tests/vol/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# to test create the two external volumes
|
||||||
|
|
||||||
|
```
|
||||||
|
podman volume create my-app-data
|
||||||
|
podman volume create actual-name-of-volume
|
||||||
|
podman-compose up
|
||||||
|
```
|
||||||
|
|
@ -27,6 +27,9 @@ services:
|
|||||||
working_dir: /var/www/html
|
working_dir: /var/www/html
|
||||||
volumes:
|
volumes:
|
||||||
- myvol2:/var/www/html
|
- myvol2:/var/www/html
|
||||||
|
- data:/var/www/html_data
|
||||||
|
- data2:/var/www/html_data2
|
||||||
|
- data3:/var/www/html_data3
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
myvol2:
|
myvol2:
|
||||||
@ -38,3 +41,6 @@ volumes:
|
|||||||
data2:
|
data2:
|
||||||
external:
|
external:
|
||||||
name: actual-name-of-volume
|
name: actual-name-of-volume
|
||||||
|
data3:
|
||||||
|
name: my-app-data3
|
||||||
|
|
||||||
|
34
tests/yamlmagic/docker-compose.yml
Normal file
34
tests/yamlmagic/docker-compose.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
version: '3.6'
|
||||||
|
|
||||||
|
x-deploy-base: &deploy-base
|
||||||
|
restart_policy:
|
||||||
|
delay: 2s
|
||||||
|
|
||||||
|
x-common: &common
|
||||||
|
network: host
|
||||||
|
deploy:
|
||||||
|
<<: *deploy-base
|
||||||
|
networks:
|
||||||
|
hostnet: {}
|
||||||
|
|
||||||
|
networks:
|
||||||
|
hostnet:
|
||||||
|
external: true
|
||||||
|
name: host
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
node-red_data:
|
||||||
|
|
||||||
|
services:
|
||||||
|
node-red:
|
||||||
|
<<: *common
|
||||||
|
image: busybox
|
||||||
|
command: busybox httpd -h /data -f -p 8080
|
||||||
|
deploy:
|
||||||
|
<<: *deploy-base
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 32M
|
||||||
|
volumes:
|
||||||
|
- node-red_data:/data
|
Reference in New Issue
Block a user