Stable Diffusion
Dockerfile
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
RUN sed -i 's|http://ports.ubuntu.com/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/|g' /etc/apt/sources.list /etc/apt/sources.list && \
apt update && \
apt install -y build-essential cmake wget git python3 python3-pip sudo
RUN pip3 install jupyterlab
RUN apt-get install -y openssh-client openssh-server && \
mkdir -p /var/run/sshd && \
sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
CMD ["sleep", "infinity"]
Check GPU:
nvidia-smi
Tue May 7 11:47:20 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03 Driver Version: 535.54.03 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 2080 Ti On | 00000000:85:00.0 Off | N/A |
| 36% 28C P8 20W / 250W | 2847MiB / 11264MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
+---------------------------------------------------------------------------------------+
Stable Diffusion
Webui
sudo apt install wget git python3 python3-venv libgl1 libglib2.0-0
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
bash webui.sh
To change configuration, edit webui-user.sh:
export COMMANDLINE_ARGS="--listen --port 5050 --subpath=/kas/py36lph9lctmsk11hp7gngmbt37n"
To use new models, download *.safetensors and put into /models/xx folder.