Last active
March 2, 2021 15:56
-
-
Save albertywu/ce473ef360048ce92ee8cc65d189ab42 to your computer and use it in GitHub Desktop.
docker tricks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run a command inside a docker container | |
| docker run --rm node ls | |
| # run multiple commands inside a docker container | |
| docker run --rm node bash -c "ls && pwd" | |
| # pipe commands from stdin | |
| echo "ls && pwd" | docker run --rm -i node bash | |
| # pipe commands from script | |
| cat myscript.sh | docker run --rm -i node bash | |
| # do it with docker-compose (drop the "-i" since it will read from STDIN by default) | |
| cat myscript.sh | docker-compose run --rm my-service bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment