Skip to content

Instantly share code, notes, and snippets.

View nerdalert's full-sized avatar
🐈
🦀 🐿

Brent Salisbury nerdalert

🐈
🦀 🐿
View GitHub Profile
@nerdalert
nerdalert / rpc.json
Last active December 19, 2015 16:59
{"Port":{"columns":["fake_bridge","interfaces","name","tag"]},"Controller":{"columns":[]},"Interface":{"columns":["name"]},"Open_vSwitch":{"columns":["bridges","cur_cfg"]},"Bridge":{"columns":["controller","fail_mode","name","ports"]}}
NC='\e[0m' # Text Reset
IYellow='\e[0;93m' # Yellow
echo -e "${IYellow}############################ ip netns exec \$(ip netns) ip a ###############################${NC}"
for ns in $(sudo ip netns);
do echo -e "${IYellow}Namespace: $ns ${NC}"
sudo ip netns exec $ns ip a | grep --color=never "BROAD\|ether\|LOOP\|global";
done
echo -e "${IYellow}###################################### (ip link show) ######################################${NC}"
sudo ip link show | grep --color "inet \|state\|$"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b9f53d516702 sensudockerworkingvanilla_sensu:latest "/tmp/sensu-run.sh" 6 hours ago Up 6 hours 5671/tcp, 6379/tcp, 4567/tcp, 0.0.0.0:3000->3000/tcp sensudockerworkingvanilla_sensu_1
0894dda2e240 sensudockerworkingvanilla_grafana:latest "/tmp/grafana-run.sh 6 hours ago Up 6 hours 0.0.0.0:4000->80/tcp sensudockerworkingvanilla_grafana_1
b7492ee9c4ca sensudockerworkingvanilla_influxdb:latest "/tmp/influxdb-run.s 6 hours ago Up 6 hours 8090/tcp, 8099/tcp, 0.0.0.0:8083->8083/tcp, 0.0.0.0:8086->8086/tcp sensudockerworkingvanilla_influxdb_1
6a4124a6b13c sensudockerworkingvanilla_redis:latest "/bin/sh -c /tmp/red 6 hours ago
$ docker-machine -D create \
> --driver amazonec2 \
> --amazonec2-access-key $AWS_ACCESS_KEY_ID \
> --amazonec2-secret-key $AWS_SECRET_ACCESS_KEY \
> --amazonec2-vpc-id $AWS_VPC_ID \
> test-instance6
INFO[0000] Launching instance...
DEBU[0001] creating key pair: test-instance6
DEBU[0001] configuring security group in vpc-42dffc27
DEBU[0001] found existing security group (docker-machine) in vpc-42dffc27
We're sorry. Based on the information provided, there are no products available for you. If you feel this is an error, please contact customer support.
### Example #1 ###
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e23d01384ac iperf-v1:latest "/usr/bin/iperf -s" 10 minutes ago Up 10 minutes 5001/tcp, 0.0.0.0:32768->5201/tcp compassionate_goodall
# Append the container ID (CID) to the end of an inspect
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' 2e23d01384ac
172.17.0.1
### Example #2 ###
# Add -q to automatically parse and return the last CID created.
#!/bin/sh
# Must have boot2docker installed if using Mac OS X
installMachineMac() {
sudo wget --no-check-certificate -O /usr/local/bin/docker-machine http://docker-machine-builds.evanhazlett.com/latest/docker-machine_darwin_amd64
sudo chmod +x /usr/local/bin/docker-machine
}
installDockerBinMac(){
sudo wget --no-check-certificate -O /usr/local/bin/docker https://get.docker.com/builds/Darwin/x86_64/docker-latest
@nerdalert
nerdalert / gist:055f0562c90bd0796172
Last active March 14, 2017 07:34
Libnetwork Feature Parity

Libnetwork Feature Parity Testing/Tutorial with Existing Docker Networking

The following parameters are global options that are set via $DOCKER_OPTS variable typically in the file /etc/default/docker. Once you start the Docker daemon, if you want to modify any of those parameters it requires a restart of the daemon:

-b BRIDGE or --bridge=BRIDGE 
--bip=CIDR
--fixed-cidr 
--fixed-cidr-v6
networkResources := &networkResource{}
if err := json.NewDecoder(strings.NewReader(testDat)).Decode(networkResources); err != nil {
return fmt.Errorf("Error reading remote info: %v", err)
}
fmt.Fprintf(cli.out, "Network Id: %s\n", networkResources.ID)
fmt.Fprintf(cli.out, "Network Name: %s\n", networkResources.Name)
fmt.Fprintf(cli.out, "Network Type: %s\n", networkResources.Type)
if networkResources.Endpoints != nil {
for _, networkResource := range networkResources.Endpoints {
fmt.Fprintf(cli.out, "Type: %d\n", networkResource.ID)
- To build/test:
cd ~/libnetwork/cmd/dnet
go build &&./dnet -d
- In another terminal:
./dnet network create net1
./dnet network create net2
./dnet network ls
./dnet network ls -q
./dnet network ls --no-trunc
./dnet network ls -q --no-trunc