Reputation: 1879
I want to ssh into a running CentOs container running inside a CentOs image. My aim is to SSH into container and install applications into it. Please provide me appropriate steps for this.
Ran below command
yum install openssh-server
Used below approach but did not get the result.
How to get into a docker container?
Upvotes: 3
Views: 1863
Reputation: 2942
You can exec in the container docker exec -it myContainer /bin/bash
mentioned above. But if you do not want to allow user to exec into container and then you can do this:
-i .ssh_key.pem
to ssh in docker container. Upvotes: 0
Reputation: 2774
You don't need to use SSH or install anything on a running container to get inside, you can use docker directly :
docker exec -it myContainer /bin/bash
Where myContainer
is the name or the ID of the running container you need to connect to.
You will be then connected as root in CentOS, and you will be able to do what you need.
To leave it and go back to your host, you need to type CTRL + P - Q.
Upvotes: 2