Skip to content

Instantly share code, notes, and snippets.

@diegovarussa
Last active October 21, 2019 05:53
Show Gist options
  • Select an option

  • Save diegovarussa/436a1fb6db881dc1436729257d5c4695 to your computer and use it in GitHub Desktop.

Select an option

Save diegovarussa/436a1fb6db881dc1436729257d5c4695 to your computer and use it in GitHub Desktop.
Use docker to run any command without install it on your Linux
#!/bin/bash
(docker build \
	--tag cfn-lint:latest \
	--quiet \
	-<<EOF
FROM python:alpine
RUN pip install cfn-lint
WORKDIR /workdir
ENTRYPOINT ["cfn-lint"]
CMD []
EOF
) &> /dev/null

docker container run \
	--interactive \
	--rm \
	--volume "$PWD":"$PWD" \
	--workdir "$PWD" \
	cfn-lint:latest "$@"
  • Create a cfn-lint file inside ~/bin
  • Just run cfn-lint --version to check it
  • Make sure ~/bin is in your PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment