There are official images on the Docker Hub.
- Version specified images are also available (VERSION: 0.21.0 and above)
shellspec/shellspec[-VARIANT]:<VERSION | master>[-kcov]
# Run docker command on the project root
$ docker run -it --rm -v "$PWD:/src" shellspec/shellspec
# Display help
$ docker run -it --rm -v "$PWD:/src" shellspec/shellspec --help
# Run with kcov (requires kcov supported image)
$ docker run -it --rm -u $(id -u):$(id -g) \
-v "$PWD:/src" shellspec/shellspec:kcov --kcov
# For users using Docker Desktop for Windows within WSL 1
$ docker run -it --rm -v "$(wslpath -wa .):/src" shellspec/shellspec
Use contrib/shellspec-docker helper script.
# Specify the Docker image to use (default: shellspec/shellspec)
$ export SHELLSPEC_DOCKER=shellspec/shellspec
# Run helper script on the project root
$ shellspec-docker
# Display help
$ shellspec-docker --help
# Run with kcov (requires kcov supported image)
$ shellspec-docker --kcov
# Enter the Docker container
$ shellspec-docker -
# Execute command with in the Docker container
$ shellspec-docker - hostname
If you want to run manually.
$ docker run -it --rm --entrypoint=/shellspec-docker \
-u $(id -u):$(id -g) -v "$PWD:/src" shellspec/shellspec
# For users using Docker Desktop for Windows within WSL 1
$ docker run -it --rm --entrypoint=/shellspec-docker \
-u $(id -u):$(id -g) -v "$(wslpath -wa .):/src" shellspec/shellspec
This file should be a shell script. You can override docker_run() to changes options, pass environment variables, etc.
Invoked before execute shellspec inside of the docker container.
Invoked after executed shellspec inside of the docker container.
Example
# Dockerfile
FROM shellspec/shellspec
RUN apk add --no-cache add-your-required-packages
COPY ./ /src
# Build and run at your project root
$ docker build -t your-project-name .
$ docker run -it your-project-name
Example
# Dockerfile
FROM buildpack-deps
RUN apt-get update && apt-get install -y add-your-required-packages
COPY --from=shellspec/shellspec-scratch /opt/shellspec /opt/shellspec
ENV PATH /opt/shellspec/:$PATH
WORKDIR /src
ENTRYPOINT [ "shellspec" ]
COPY ./ /src
# Build and run at your project root
$ docker build -t your-project-name .
$ docker run -it your-project-name
Example
contrib/build.sh .dockerhub/Dockerfile shellspec
contrib/build.sh .dockerhub/Dockerfile shellspec kcov
contrib/build.sh .dockerhub/Dockerfile.debian shellspec-debian
contrib/build.sh .dockerhub/Dockerfile.debian shellspec-debian kcov
contrib/build.sh .dockerhub/Dockerfile.scratch shellspec-scratch