Skip to content

Instantly share code, notes, and snippets.

@seafooler
Created January 3, 2018 02:48
Show Gist options
  • Save seafooler/3f3e344ae4a1c8a1d2cac5e228ee218d to your computer and use it in GitHub Desktop.
Save seafooler/3f3e344ae4a1c8a1d2cac5e228ee218d to your computer and use it in GitHub Desktop.
Specify the ip address of a Docker container && ssh it
# 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