Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rename default container name to localstack-main #9469

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

Merged
merged 2 commits into from
Nov 2, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PIP_CMD ?= pip3
TEST_PATH ?= .
PYTEST_LOGLEVEL ?=
DISABLE_BOTO_RETRIES ?= 1
MAIN_CONTAINER_NAME ?= localstack_main
MAIN_CONTAINER_NAME ?= localstack-main

MAJOR_VERSION = $(shell echo ${IMAGE_TAG} | cut -d '.' -f1)
MINOR_VERSION = $(shell echo ${IMAGE_TAG} | cut -d '.' -f2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ services:
- KAFKA_BROKERS=kafka:29092

localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
container_name: "${LOCALSTACK_DOCKER_NAME-localstack-main}"
image: localstack/localstack
network_mode: bridge
ports:
Expand All @@ -69,4 +69,4 @@ services:
- HOST_TMP_FOLDER=${TMPDIR}
volumes:
- "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
- "/var/run/docker.sock:/var/run/docker.sock"
2 changes: 1 addition & 1 deletion docker-compose-pro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
container_name: "${LOCALSTACK_DOCKER_NAME-localstack-main}"
image: localstack/localstack-pro # required for Pro
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
container_name: "${LOCALSTACK_DOCKER_NAME-localstack-main}"
image: localstack/localstack
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
Expand Down
8 changes: 4 additions & 4 deletions localstack/cli/localstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def cmd_stop() -> None:
Stops the current LocalStack runtime.

This command stops the currently running LocalStack docker container.
By default, this command looks for a container named `localstack_main` (which is the default
By default, this command looks for a container named `localstack-main` (which is the default
container name used by the `localstack start` command).
If your LocalStack container has a different name, set the config variable
`MAIN_CONTAINER_NAME`.
Expand Down Expand Up @@ -597,7 +597,7 @@ def cmd_logs(follow: bool, tail: int) -> None:
Show the logs of the current LocalStack runtime.

This command shows the logs of the currently running LocalStack docker container.
By default, this command looks for a container named `localstack_main` (which is the default
By default, this command looks for a container named `localstack-main` (which is the default
container name used by the `localstack start` command).
If your LocalStack container has a different name, set the config variable
`MAIN_CONTAINER_NAME`.
Expand Down Expand Up @@ -647,7 +647,7 @@ def cmd_wait(timeout: Optional[float] = None) -> None:

This commands waits for a started LocalStack runtime to be up and running, ready to serve
requests.
By default, this command looks for a container named `localstack_main` (which is the default
By default, this command looks for a container named `localstack-main` (which is the default
container name used by the `localstack start` command).
If your LocalStack container has a different name, set the config variable
`MAIN_CONTAINER_NAME`.
Expand All @@ -665,7 +665,7 @@ def cmd_ssh() -> None:
Obtain a shell in the current LocalStack runtime.

This command starts a new interactive shell in the currently running LocalStack container.
By default, this command looks for a container named `localstack_main` (which is the default
By default, this command looks for a container named `localstack-main` (which is the default
container name used by the `localstack start` command).
If your LocalStack container has a different name, set the config variable
`MAIN_CONTAINER_NAME`.
Expand Down
2 changes: 1 addition & 1 deletion localstack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def legacy_fallback(envar_name: str, default: T) -> T:
os.environ["MOTO_ALLOW_NONEXISTENT_REGION"] = "true"

# name of the main Docker container
MAIN_CONTAINER_NAME = os.environ.get("MAIN_CONTAINER_NAME", "").strip() or "localstack_main"
MAIN_CONTAINER_NAME = os.environ.get("MAIN_CONTAINER_NAME", "").strip() or "localstack-main"

# the latest commit id of the repository when the docker image was created
LOCALSTACK_BUILD_GIT_HASH = os.environ.get("LOCALSTACK_BUILD_GIT_HASH", "").strip() or None
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_validate_config(runner, monkeypatch, tmp_path):
"""version: "3.3"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
container_name: "${LOCALSTACK_DOCKER_NAME-localstack-main}"
image: localstack/localstack
network_mode: bridge
ports:
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/test_dockerclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_list_containers(self, run_mock):
mock_container = {
"ID": "00000000a1",
"Image": "localstack/localstack",
"Names": "localstack_main",
"Names": "localstack-main",
"Labels": "authors=LocalStack Contributors",
"State": "running",
}
Expand All @@ -52,16 +52,16 @@ def test_list_containers(self, run_mock):

@patch("localstack.utils.container_utils.docker_cmd_client.run")
def test_container_status(self, run_mock):
test_output = "Up 2 minutes - localstack_main"
test_output = "Up 2 minutes - localstack-main"
run_mock.return_value = test_output
docker_client = CmdDockerClient()
status = docker_client.get_container_status("localstack_main")
status = docker_client.get_container_status("localstack-main")
assert status == DockerContainerStatus.UP
run_mock.return_value = "Exited (0) 1 minute ago - localstack_main"
status = docker_client.get_container_status("localstack_main")
run_mock.return_value = "Exited (0) 1 minute ago - localstack-main"
status = docker_client.get_container_status("localstack-main")
assert status == DockerContainerStatus.DOWN
run_mock.return_value = "STATUS NAME"
status = docker_client.get_container_status("localstack_main")
status = docker_client.get_container_status("localstack-main")
assert status == DockerContainerStatus.NON_EXISTENT


Expand Down