Question 1
I'm looking for a way to SSH into my running container or the hosting VM in Azure App Service for Docker Containers (Linux). I've read the doc for enabling SSH when configuring a custom container and this question. However, both links requires me to install openssh
in my image:
# Install OpenSSH and set the password for root to "Docker!". In this example, "apk add" is the install instruction for an Alpine Linux-based image.
RUN apk add openssh \
&& echo "root:Docker!" | chpasswd
# Copy the sshd_config file to the /etc/ssh/ directory
COPY sshd_config /etc/ssh/
# Open port 2222 for SSH access
EXPOSE 80 2222
I don't want this for my image as it may introduce security issues. Can I connect directly to the VM that hosts my containers and do something like docker exec -it <container name> /bin/bash
?
Question 2
If I do install openssh
and SSH into the container this way, what happens if I have auto-scaling and multiple instances/containers running, which container am I SSHing into?