Last active
July 5, 2022 19:50
-
-
Save MrChrisWeinert/274d487d9e626262d879691b4ddc90d2 to your computer and use it in GitHub Desktop.
Just a collection of stuff I use to troubleshoot Docker and networking issues
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
#Stop/Remove a specific Docker Container | |
docker stop containername && docker rm containername | |
#Stop all containers with "backend" in it: | |
docker rm $(docker ps -a | grep backend | cut -f1 -d' ') | |
#Stop all Docker Containers | |
docker stop $(docker ps -aq) | |
#Remove all Docker Containers | |
docker rm $(docker ps -aq) | |
#To capture TCP data from a Docker Container | |
IP=`docker inspect containername | grep 'IPAddress":' | cut -f4 -d'"' | head -1` && sudo tcpdump -i docker0 host $IP | |
#Show all iptables rules | |
sudo iptables -L | |
#Show all iptables rules with line numbers | |
sudo iptables -L --line-numbers | |
#To delete a rule, do a -D followed by the Chain name (INPUT) followed by the line number (3) | |
sudo iptables -D INPUT 3 | |
#Turn off iptables (do this all on one line, or else your SSH session will die) | |
sudo iptables -F && sudo iptables -X && sudo iptables -P INPUT ACCEPT && sudo iptables -P OUTPUT ACCEPT && sudo iptables -P FORWARD ACCEPT | |
#Persist current firewall settings by saving them here | |
iptables-save > /etc/iptables/rules.v4 | |
#Save current firewall rules to a file | |
sudo iptables-save > fw.rules | |
#Restore firewall rules from a file | |
sudo iptables-restore fw.rules | |
#Hand-edit firewall rules here: | |
sudo vi /etc/iptables/rules.v4 | |
#SCP a file from my local machine to a remote one: | |
scp ciscat-full-bundle-2019-09-25-v3.0.61.zip username@remotehost:ciscat-full-bundle-20 | |
19-09-25-v3.0.61.zip | |
#SCP a file from a remote machine to my mine: | |
scp user@remotehost:cis-cat-full/results/filename.html filename.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment