Skip to content

Docker

Docker is effectively a cross-platform software package repository. It allows you to ship an entire environment in what's referred to as a container. Containers are intended to hold everything that is needed to run an application from one place to another, making it easy for everyone along the way to reproduce the environment.

The stash Docker container ships with everything you need to automatically run stash, including ffmpeg.

Info

Before starting make sure your system has Docker installed. You can follow the instructions on how to install Docker from Docker Docs.

Official

stashapp team hosted image

Details

  • No hardware acceleration support
  • No Python manager included
  • Full ARM compatability

Docker Compose

https://github.com/stashapp/stash/blob/master/docker/production/docker-compose.yml

# APPNICENAME=Stash
# APPDESCRIPTION=An organizer for your porn, written in Go
services:
  stash:
    image: stashapp/stash:latest
    container_name: stash
    restart: unless-stopped
    ## the container's port must be the same with the STASH_PORT in the environment section
    ports:
      - "9999:9999"
    ## If you intend to use stash's DLNA functionality uncomment the below network mode and comment out the above ports section
    # network_mode: host
    logging:
      driver: "json-file"
      options:
        max-file: "10"
        max-size: "2m"
    environment:
      - STASH_STASH=/data/
      - STASH_GENERATED=/generated/
      - STASH_METADATA=/metadata/
      - STASH_CACHE=/cache/
      ## Adjust below to change default port (9999)
      - STASH_PORT=9999
    volumes:
      - /etc/localtime:/etc/localtime:ro
      ## Adjust below paths (the left part) to your liking.
      ## E.g. you can change ./config:/root/.stash to ./stash:/root/.stash
      ## The left part is the path on your host, the right part is the path in the stash container.

      ## Keep configs, scrapers, and plugins here.
      - ./config:/root/.stash
      ## Point this at your collection.
      ## The left side is where your collection is on your host, the right side is where it will be in stash.
      - ./data:/data
      ## This is where your stash's metadata lives
      - ./metadata:/metadata
      ## Any other cache content.
      - ./cache:/cache
      ## Where to store binary blob data (scene covers, images)
      - ./blobs:/blobs
      ## Where to store generated content (screenshots,previews,transcodes,sprites)
      - ./generated:/generated

Dockerfile (x86_64)

https://github.com/stashapp/stash/blob/master/docker/build/x86_64/Dockerfile

# This dockerfile should be built with `make docker-build` from the stash root.

# Build Frontend
FROM node:20-alpine AS frontend
RUN apk add --no-cache make git
## cache node_modules separately
COPY ./ui/v2.5/package.json ./ui/v2.5/yarn.lock /stash/ui/v2.5/
WORKDIR /stash
COPY Makefile /stash/
COPY ./graphql /stash/graphql/
COPY ./ui /stash/ui/
RUN make pre-ui
RUN make generate-ui
ARG GITHASH
ARG STASH_VERSION
RUN BUILD_DATE=$(date +"%Y-%m-%d %H:%M:%S") make ui-only

# Build Backend
FROM golang:1.24.3-alpine AS backend
RUN apk add --no-cache make alpine-sdk
WORKDIR /stash
COPY ./go* ./*.go Makefile gqlgen.yml .gqlgenc.yml /stash/
COPY ./graphql /stash/graphql/
COPY ./scripts /stash/scripts/
COPY ./pkg /stash/pkg/
COPY ./cmd /stash/cmd/
COPY ./internal /stash/internal/
# needed for generate-login-locale
COPY ./ui /stash/ui/
RUN make generate-backend generate-login-locale
COPY --from=frontend /stash /stash/
ARG GITHASH
ARG STASH_VERSION
RUN make flags-release flags-pie stash

# Final Runnable Image
FROM alpine:latest
RUN apk add --no-cache ca-certificates vips-tools ffmpeg
COPY --from=backend /stash/stash /usr/bin/
ENV STASH_CONFIG_FILE=/root/.stash/config.yml
EXPOSE 9999
ENTRYPOINT ["stash"]

Dockerfile-CUDA (x86_64)

https://github.com/stashapp/stash/blob/master/docker/build/x86_64/Dockerfile-CUDA

Notable changes

  • Adds support for NVENC
  • Adds Intel QSV drivers
# This dockerfile should be built with `make docker-cuda-build` from the stash root.
ARG CUDA_VERSION=12.8.0

# Build Frontend
FROM node:20-alpine AS frontend
RUN apk add --no-cache make git
## cache node_modules separately
COPY ./ui/v2.5/package.json ./ui/v2.5/yarn.lock /stash/ui/v2.5/
WORKDIR /stash
COPY Makefile /stash/
COPY ./graphql /stash/graphql/
COPY ./ui /stash/ui/
RUN make pre-ui
RUN make generate-ui
ARG GITHASH
ARG STASH_VERSION
RUN BUILD_DATE=$(date +"%Y-%m-%d %H:%M:%S") make ui-only

# Build Backend
FROM golang:1.24.3-bullseye AS backend
RUN apt update && apt install -y build-essential golang
WORKDIR /stash
COPY ./go* ./*.go Makefile gqlgen.yml .gqlgenc.yml /stash/
COPY ./graphql /stash/graphql/
COPY ./scripts /stash/scripts/
COPY ./pkg /stash/pkg/
COPY ./cmd /stash/cmd
COPY ./internal /stash/internal
# needed for generate-login-locale
COPY ./ui /stash/ui/
RUN make generate-backend generate-login-locale
COPY --from=frontend /stash /stash/
ARG GITHASH
ARG STASH_VERSION
RUN make flags-release flags-pie stash

# Final Runnable Image
FROM nvidia/cuda:${CUDA_VERSION}-base-ubuntu24.04
RUN apt update && apt upgrade -y && apt install -y \
    # stash dependencies
    ca-certificates libvips-tools ffmpeg \
    # intel dependencies
    intel-media-va-driver-non-free vainfo \
    # python tools
    python3 python3-pip && \
  # cleanup
  apt autoremove -y && apt clean && \
  rm -rf /var/lib/apt/lists/*
COPY --from=backend --chmod=555 /stash/stash /usr/bin/

# NVENC Patch
RUN mkdir -p /usr/local/bin /patched-lib
ADD --chmod=555 https://raw.githubusercontent.com/keylase/nvidia-patch/master/patch.sh /usr/local/bin/patch.sh
ADD --chmod=555 https://raw.githubusercontent.com/keylase/nvidia-patch/master/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

ENV LANG=C.UTF-8
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=video,utility
ENV STASH_CONFIG_FILE=/root/.stash/config.yml
EXPOSE 9999
ENTRYPOINT ["docker-entrypoint.sh", "stash"]

# vim: ft=dockerfile

Community images

Disclaimer

The images are not managed by stashapp team.

feederbox826

Details

  • Hardware acceleration support
  • uv Python manager

nerethos

Details

  • Hardware acceleration support
  • venv Python manager

Using Docker Compose

Note

Condensed instructions are available here.

  1. Download and save docker-compose.yml file from our GitHub.
  2. Modify the docker-compose.yml file to your preferences.
  3. Open terminal in the same directory as saved docker-compose.yml or cd to that directory.
  4. Run docker compose up -d.
  5. Installing this way will bound Stash to port 9999.
  6. If everything went well Stash will be available at http://localhost:9999 locally or on your network http://YOUR-LOCAL-IP:9999.

Update

Migrating from <=v0.20

If you are upgrading from older than v0.20 version make sure to re-download the docker-compose.yml file from our GitHub as new volume was added.
Alternatively you can edit the docker-compose.yml to manually include new volume: - ./blobs:/blobs.

  1. Go to the directory where docker-compose.yml is saved.
  2. Run docker-compose pull. Pulls the new image.
  3. Run docker-compose down. Removes old container.
  4. Run docker compose up -d. Creates and starts the new container.
  5. Make sure the mount points and settings are the same as in previous docker-compose.yml file.

Remove

  1. Go to the directory where docker-compose.yml is saved.
  2. Run docker container kill. Force stops the container.
  3. Run docker container rm. Removes the container.
  4. Delete docker-compose.yml file.