> ## Documentation Index
> Fetch the complete documentation index at: https://otoyinc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker images

Most Docker images will work out of the box on Dispersed but if you want to have SSH access to your image you'll need to run an SSH server and populate your `authorized_keys` file with appropriate public keys. When creating a Dispersed Job anything you pass to the 'sshkey' parameter will be accessible in the Docker container as the environmental variable `SSH_PUBKEY`,  the same applies in a Dispersed Job Recipe for an SSH Key type field in your Input Schema.

We provide some examples of Dockerfiles and entrypoints at [https://github.com/dispersednetwork/compute\_examples/tree/main/docker-images](https://github.com/dispersednetwork/compute_examples/tree/main/docker-images)<br /><br />A basic example of adding Dispersed SSH to an existing image:

```text 10-sshd theme={null}
duser ALL = NOPASSWD: /usr/sbin/sshd
duser ALL = NOPASSWD: /usr/sbin/dpkg-reconfigure openssh-server
```

```text Dockerfile theme={null}
FROM ghcr.io/ggml-org/llama.cpp:server-cuda
EXPOSE 22
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y openssh-server sudo
RUN DEBIAN_FRONTEND=noninteractive apt autoremove -y &&  rm -rf /var/cache/apt/archives /var/lib/apt/lists

RUN mkdir /var/run/sshd
COPY --chown=root:root --chmod=700 10-sshd /etc/sudoers.d/10-ssh

RUN mkdir -p /opt/dispersedworker/
WORKDIR /app
RUN groupadd -r duser; useradd -r -g duser -d /opt/dispersedworker/ duser -s /bin/bash; chown -R duser:duser /opt/dispersedworker/; cd /opt/dispersedworker/

# delete ssh host keys so they can be generated at runtime
RUN rm -v /etc/ssh/ssh_host_*

COPY --chown=root:root --chmod=755 entrypoint.sh /opt/dispersedworker/entrypoint.sh
USER duser

ENTRYPOINT ["/opt/dispersedworker/entrypoint.sh"]
```

```text entrypoint.sh theme={null}
#!/bin/bash

if [[ -z "${SSH_PUBKEY}" ]]; then
	echo "No SSH_PUBKEY set, not starting sshd"
else
	echo "Generating host keys"
	 /usr/bin/sudo /usr/sbin/dpkg-reconfigure openssh-server > /dev/null 2>&1
	echo "Starting sshd"
	/usr/bin/sudo /usr/sbin/sshd -D &
fi

if [[ -z "${SSH_PUBKEY}" ]]; then
	echo "No SSH_PUBKEY set, not creating authorized_keys"
else
	mkdir -p ~/.ssh
	echo -e $SSH_PUBKEY > ~/.ssh/authorized_keys
	chmod 700 ~/.ssh
	chmod 600 ~/.ssh/authorized_keys
fi

/app/llama-server


# wait until everything has exited then do likewise.
wait -n
exit $?
```
