Skip to content

Instantly share code, notes, and snippets.

@omerucel
Created June 19, 2018 11:23
Show Gist options
  • Save omerucel/8e122941dd11a86dc826647062384d20 to your computer and use it in GitHub Desktop.
Save omerucel/8e122941dd11a86dc826647062384d20 to your computer and use it in GitHub Desktop.
Docker Aliases
composer () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
composer "$@"
}
php72 () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
--workdir /app \
php:7.2-cli-alpine php "$@"
}
npm () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
--workdir /app \
node:9-alpine npm "$@"
}
node () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
--workdir /app \
node:9-alpine node "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment