Simplysm Compose
🇰🇷 한국어 설명은 아래에 있습니다.
Starts a folder's Docker Compose services when you open the folder in VS Code, and stops them when the folder leaves the window.
Keep each project's database and other services in the project's own Compose file instead of installing them on your PC. Then every project gets the service versions it needs, and the services run only while you work on that project.
Setup
Put a Compose file (compose.yaml, compose.yml, docker-compose.yaml or docker-compose.yml) in the folder root — the same file docker compose up finds there.
Turn the extension on for the folder in the folder's .vscode/settings.json:
{
"simplysm-compose.autoStart": true
}
Commit both files, and everyone who opens the project gets the same services.
Folders without this setting are never started, even if they have a Compose file. The setting in your user settings is ignored: the project decides.
How it works
- Opening the folder → runs
docker compose up --detach --wait in the folder and waits until the services are actually running. If Docker is not running, Docker Desktop is started first (up to 3 minutes).
- The folder leaves the window (closing the window, removing the folder from the workspace, opening another folder in the window) → runs
docker compose stop. Containers and their data are kept; Docker Desktop keeps running.
- Multi-root workspaces → each folder is handled by its own setting and Compose file.
- Restricted Mode → the extension does not run in folders you have not trusted, because Compose can run any image and mount folders of your PC.
- Every
docker command and its output is in the Simplysm Compose output channel, except the output of docker compose config: it holds the environment variables (passwords, for example) of the Compose file.
When something fails
An error notification tells you the cause and what to do, with a Retry button. The extension never fixes the cause for you.
| Cause |
What you are told |
| A port of the Compose file is in use |
The port and who uses it (a program, a container or another Compose project's service). The services are not started, so you never connect to the wrong server. |
| No Compose file in the folder |
Add one, or turn the setting off |
| Docker is not installed |
Install Docker Desktop |
| Docker is not running and there is no Docker Desktop |
Start Docker |
| Docker Desktop did not start within 3 minutes |
Start Docker Desktop yourself |
| The Compose file has an error |
Docker's error message |
| An image could not be pulled |
The image name; check the network and the name |
| A service stopped right after it started |
The service name; Show Log shows its output |
| Anything else |
Docker's error message; Show Log opens the output channel |
If stopping fails after the window is gone, an OS alert window tells you, with Retry and Close. On Linux this needs zenity; without it the failure is only written to the extension's log.
Limitations
- If VS Code crashes, the services may keep running.
- While VS Code is closed the services are stopped, so anything outside VS Code that uses them (for example tests run from another terminal) can't reach them. If another program uses the same port, it reaches that program instead without an error.
- Reloading the window (Developer: Reload Window) stops the services and starts them again.
English/Korean UI.
한국어 (Korean)
VS Code 로 폴더를 열면 그 폴더의 Docker Compose 서비스를 띄우고, 폴더가 창에서 빠지면 멈춥니다.
프로젝트마다 DB 같은 서비스를 PC 에 설치하지 않고 그 프로젝트의 Compose 파일에 둡니다. 그러면 프로젝트마다 필요한 서비스 버전을 쓰고, 그 프로젝트로 일하는 동안만 서비스가 떠 있습니다.
설정
폴더 루트에 Compose 파일(compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml)을 둡니다. 그 폴더에서 docker compose up 이 찾는 파일과 같습니다.
그 폴더의 .vscode/settings.json 에 아래 설정을 넣어 이 확장을 켭니다.
{
"simplysm-compose.autoStart": true
}
두 파일을 커밋하면 그 프로젝트를 여는 사람 모두가 같은 서비스를 씁니다.
이 설정이 없는 폴더는 Compose 파일이 있어도 띄우지 않습니다. 사용자 설정에 넣은 값은 읽지 않습니다. 프로젝트가 정합니다.
동작 방식
- 폴더를 열면 → 그 폴더에서
docker compose up --detach --wait 를 돌리고, 서비스가 실제로 떠 있을 때까지 기다립니다. Docker 가 꺼져 있으면 먼저 Docker Desktop 을 켭니다(3분까지 기다림).
- 폴더가 창에서 빠지면(창 닫기, 워크스페이스에서 폴더 빼기, 그 창에서 다른 폴더 열기) →
docker compose stop 을 돌립니다. 컨테이너와 데이터는 남고, Docker Desktop 은 끄지 않습니다.
- 여러 폴더 워크스페이스 → 폴더마다 그 폴더의 설정과 Compose 파일로 따로 다룹니다.
- 제한 모드 → 신뢰하지 않은 폴더에서는 동작하지 않습니다. Compose 는 아무 이미지나 실행하고 PC 의 폴더를 연결할 수 있기 때문입니다.
- 실행한
docker 명령과 그 출력은 출력 채널 Simplysm Compose 에 남습니다. 다만 docker compose config 의 출력은 Compose 파일의 환경 변수(예: 비밀번호)를 담으므로 남기지 않습니다.
실패했을 때
오류 알림이 원인과 할 일을 알리고 다시 시도 단추를 줍니다. 원인은 확장이 대신 풀지 않습니다.
| 원인 |
알림이 알리는 것 |
| Compose 파일이 여는 포트를 이미 쓰고 있음 |
그 포트와 쓰는 쪽(프로그램, 컨테이너, 다른 Compose 프로젝트의 서비스). 서비스를 띄우지 않으므로 엉뚱한 서버에 붙지 않습니다. |
| 폴더에 Compose 파일이 없음 |
파일을 만들거나 설정을 끄라고 알림 |
| Docker 가 설치되어 있지 않음 |
Docker Desktop 을 설치하라고 알림 |
| Docker 가 꺼져 있고 Docker Desktop 이 없음 |
Docker 를 켜라고 알림 |
| Docker Desktop 이 3분 안에 켜지지 않음 |
Docker Desktop 을 직접 켜라고 알림 |
| Compose 파일 오류 |
Docker 의 오류 문구 |
| 이미지를 받지 못함 |
이미지 이름. 네트워크와 이름을 확인하라고 알림 |
| 서비스가 뜨자마자 멈춤 |
서비스 이름. 로그 보기 가 그 서비스의 출력을 보입니다 |
| 그 밖 |
Docker 의 오류 문구. 로그 보기 가 출력 채널을 엽니다 |
창이 사라진 뒤 멈추기가 실패하면 OS 경고 창이 다시 시도·닫기 단추와 함께 알립니다. Linux 에서는 zenity 가 있어야 하고, 없으면 확장의 로그에만 남깁니다.
한계
- VS Code 가 비정상 종료되면 서비스가 남을 수 있습니다.
- VS Code 를 닫아 두면 서비스가 멈춰 있으므로, VS Code 밖에서 그 서비스를 쓰는 일(예: 다른 터미널에서 돌리는 시험)은 서비스에 닿지 못합니다. 같은 포트를 다른 프로그램이 쓰고 있으면 오류 없이 그 프로그램에 붙습니다.
- 창을 다시 불러오면(Developer: Reload Window) 서비스가 멈췄다가 다시 뜹니다.
영어/한국어 UI 지원.
| |