Skip to content

Instantly share code, notes, and snippets.

@erszcz
Created December 29, 2025 15:14
Show Gist options
  • Select an option

  • Save erszcz/bb6b0dcbbabe7473f31d43ee07d8de9f to your computer and use it in GitHub Desktop.

Select an option

Save erszcz/bb6b0dcbbabe7473f31d43ee07d8de9f to your computer and use it in GitHub Desktop.
Linux shell on macOS
export HOST_PWD=${PWD}
export COMPOSE_PROJECT_NAME=$(basename $PWD)
# docker-compose.yml
services:
linux_shell:
image: docker.io/library/ubuntu
command: sleep infinity
volumes:
- ${HOST_PWD}:${HOST_PWD}
working_dir: ${HOST_PWD}
.PHONY: linux-shell
linux-shell:
docker compose up -d
docker exec -it $$COMPOSE_PROJECT_NAME-linux_shell-1 bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment