Created
January 3, 2018 02:48
-
-
Save seafooler/3f3e344ae4a1c8a1d2cac5e228ee218d to your computer and use it in GitHub Desktop.
Specify the ip address of a Docker container && ssh it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a specified network bridge | |
``` | |
docker network create -o "com.docker.network.bridge.name"="docker1" --subnet 172.20.0.0/24 docker1 | |
``` | |
# Run a container | |
``` | |
docker run -d --rm --ip 172.20.0.50 --net docker1 --name friendly-container rastasheep/ubuntu-sshd:14.04 | |
``` | |
# Ssh it | |
``` | |
ssh [email protected] #passwd is root, which is set in rastasheep/ubuntu-sshd:14.04 | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment