How do I ssh into the Pi-hole docker

Hi,

I wonder if its possible to ssh into Pi-hole when its running on a docker. I tried adding -p 22:22 but it doesn't appear to accept ssh.

I know I can call docker exec to execute commands on Pi-hole, but wondered if I could do it with a shell access, or is that not possible with docker?

pi@noads:~ $ cat ~/.bashrc
[..]
alias ddg='surfraw duckduckgo -l'
alias google='surfraw google -l'
[..]

pi@noads:~ $ ddg docker attach

Description

   Attach local standard input, output, and error streams to a running
   container

Usage
https://docs.docker.com/engine/reference/commandline/attach/

Thank you again.
You are having fun with that surfraw command I see. :grin:

Yeah new trick I learned :wink:
SSH into NAS and attach.

Have looksee here bout running SSH in a container:

Images should contain the bare minimum amount of code necessary to run whichever service or application you are creating the image for. Exclude any non-essential services from the image. For example, in most cases there is no reason to include an SSH server inside a container image because you can log into the container in other, more secure ways. So don’t include SSH.

Saying "Don't do this" is not an answer to the question "How do I do this?"

You can't do that, there's no daemon listening for ssh inside the container. User the docker native commands to get a shell inside a container.

Chroot into the docker instance file system.
Mount necessary tools.
Debootstrap sshd and dependencies.
Does that help :wink:

I found this thread because I'm trying to do a two way sync between pihole installations. One is a docker, and the other is on a rpi. Haven't figured it out yet.
This looks like what I was looking for:

then to here: