Skip to content

Instantly share code, notes, and snippets.

@muratgozel
Created October 27, 2021 14:15
Show Gist options
  • Save muratgozel/20d99fce6ede74c8108f123248d711fd to your computer and use it in GitHub Desktop.
Save muratgozel/20d99fce6ede74c8108f123248d711fd to your computer and use it in GitHub Desktop.
Find docker service id by service name in docker compose.
import {execSync} from 'child_process'
const service = 'some_service'
const containerId = execSync(`docker ps -f name=${service} --quiet`).toString().trim()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment