l1na-forever / stable-diffusion-rocm-docker

Stable Diffusion Docker image preconfigured for usage with AMD Radeon cards
120 stars 20 forks source link

How to create an alias? #6

Open Flanpit opened 1 year ago

Flanpit commented 1 year ago

Sorry, this might seem a bit silly, but I have no clue how to make the alias. I was able to pull it for docker just fine, but everything after that eludes me

l1na-forever commented 1 year ago

Hi! That'll depend on the shell you're using (if you aren't sure, try echo $SHELL). Typically, this will look like adding a line that sets up the alias into your shell's profile/user configuration, so that it persists after you reopen the shell (like in ~/.zshrc for zsh, or ~/.bashrc for bash).

Or, approximately, copy and paste these lines into ~/.zshrc or ~/.bashrc:

alias drun='docker run -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/pwd'
alias sd='drun --name sd l1naforever/stable-diffusion-rocm:baked'

.. and the next time you open a shell, you can type sd to invoke the alias. Since the container will also be named sd (the --name sd parameter to docker run), you can also start it subsequent times with the docker start sd/docker attach sd commands, regardless of if you've created the sd alias for your shell.