Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LAUNCH_EXT_NETWORKS_IPV4 #26

Merged
merged 3 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ The following environment variables are important if you don't supply a `/docker
| `LAUNCH_PORTS` | - | NO | Space separated list of PortOnHost:PortInContainer |
| `LAUNCH_NETWORKS` | - | NO | Space separated list of project networks to create. All networks are created with `attachable: true` |
| `LAUNCH_EXT_NETWORKS` | - | NO | Space separated list of external networks to attach to |
| `LAUNCH_EXT_NETWORKS_IPV4` | - | NO | Space separated list of ExternalNetwork:Ipv4Address |
| `LAUNCH_CAP_ADD` | - | NO | Space separated list of capabilities to add |
| `LAUNCH_CAP_DROP` | - | NO | Space separated list of capabilities to drop |
| `LAUNCH_SECURITY_OPT` | - | NO | Space separated list of security options to add |
Expand Down
13 changes: 11 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ if [ -f ${COMPOSE_FILE} ]; then
'LAUNCH_PORTS'
'LAUNCH_NETWORKS'
'LAUNCH_EXT_NETWORKS'
'LAUNCH_EXT_NETWORKS_IPV4'
'LAUNCH_CAP_ADD'
'LAUNCH_CAP_DROP'
'LAUNCH_SECURITY_OPT'
Expand Down Expand Up @@ -253,10 +254,18 @@ xEOF
if [ -n "${LAUNCH_NETWORKS}" ] || [ -n "${LAUNCH_EXT_NETWORKS}" ]; then
echo " networks:" >> ${COMPOSE_FILE}
for NETWORK in ${LAUNCH_NETWORKS}; do
echo " - ${NETWORK}" >> ${COMPOSE_FILE}
echo " ${NETWORK}:" >> ${COMPOSE_FILE}
done
for NETWORK in ${LAUNCH_EXT_NETWORKS}; do
echo " - ${NETWORK}" >> ${COMPOSE_FILE}
echo " ${NETWORK}:" >> ${COMPOSE_FILE}
if [ -n "${LAUNCH_EXT_NETWORKS_IPV4}" ]; then
for NETWORK_IPV4 in ${LAUNCH_EXT_NETWORKS_IPV4}; do
if [ "${NETWORK_IPV4%%:*}" = "${NETWORK}" ]; then
echo " ipv4_address: ${NETWORK_IPV4##*:}" >> ${COMPOSE_FILE}
break
fi
done
fi
done
echo "networks:" >> ${COMPOSE_FILE}
for NETWORK in ${LAUNCH_NETWORKS}; do
Expand Down