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

Is specifying a Docker network supported? #198

Open
danw-mpl opened this issue Aug 19, 2021 · 3 comments
Open

Is specifying a Docker network supported? #198

danw-mpl opened this issue Aug 19, 2021 · 3 comments

Comments

@danw-mpl
Copy link

Hello,

We're using Docker Compose to launch Localstack and another container which runs a CloudFormation template against it on launch. To do this, both containers need to be on the same network to resolve the localstack hostname.

I can't find an option in Commandeer to specify the Docker network that Localstack is using. Is this available? If not, is possible to request this as a feature?

Alternatively if anyone else is running a CloudFormation template against Localstack, happy to change our approach.

@bwship
Copy link
Collaborator

bwship commented Aug 19, 2021

@danw-mpl - Would you specify that in your docker-compose? There is not currently an explicit way to specify it in the Commandeer UI, but I am happy to add that. How exactly would it work?

@danw-mpl
Copy link
Author

Hello, thanks for replying.

Straight forward enough. Using the standard Docker Compose way of creating named networks. Example:

services:
  localstack:
    {...}
    networks:
      - localstack
    {...}

networks:
  localstack:
    driver: bridge
    name: localstack

In terms of getting the network(s) the container is attached to, there are a couple ways:

Possibly an option although the network 'ID' is present in the array and the user won't know what it is without using the Docker CLI.

$>docker inspect -f '{{range.NetworkSettings.Networks}}{{.Aliases}}{{end}}' localstack_main
[0172d5097474 localstack]

An option to get the first network in the array

$>docker inspect localstack_main | jq -r '.[].NetworkSettings.Networks | keys | first'
localstack

Alternatively you could just run docker inspect localstack_main and work out how to get the network key:

$>docker inspect localstack_main
    {
        "Id": "0172d509747472fa0239dca1bed9a1d88cc2378bfbc15f53089d78e31107f21c",
        {...}
        "NetworkSettings": {
           {...}
            "Networks": {
                "localstack": {
                    {...}
                    "Aliases": [
                        "0172d5097474",
                        "localstack"
                    ],
                    {...}
                }
            }
        }
    }
]

@bwship bwship added this to Backlog in Commandeer App Aug 19, 2021
@danw-mpl
Copy link
Author

danw-mpl commented Sep 13, 2021

Found a workaround for my use case.

To get DNS name resolution working between containers and have Localstack available from the host (for Commandeer), I added two networks to docker-compose.yml.

- default
- localstack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Commandeer App
  
Backlog
Development

No branches or pull requests

2 participants