Last active
December 10, 2019 15:25
-
-
Save ZiTAL/5d7c0abf94cea553f67828e0baa0e6bc to your computer and use it in GitHub Desktop.
docker laradock
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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
from sys import exit, argv | |
from getpass import getuser | |
from subprocess import getoutput | |
from re import findall, MULTILINE | |
user = getuser() | |
if user != 'root': | |
print("root required") | |
exit() | |
deny = ['lo', 'eth1', 'vboxnet0'] | |
c = 'systemctl stop docker' | |
print(c) | |
getoutput(c) | |
c = 'ip addr show' | |
r = getoutput(c) | |
o = findall(r"[0-9]+:\s+([^:]+):", r, MULTILINE) | |
for interface in o: | |
if interface in deny: | |
pass | |
else: | |
c = "ip link set "+interface+" down" | |
print(c) | |
getoutput(c) | |
if len(argv)>1 and argv[1] == 'stop': | |
print('docker stopped') | |
else: | |
c = 'systemctl start docker' | |
getoutput(c) | |
print('docker reseted') |
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
# nginx martxan imiñi | |
docker-compose up -d nginx | |
# docker-en kontenedoriek gelditsu | |
docker-compose stop | |
# bash-era konekta | |
docker-compose exec -u laradock workspace bash | |
# bash-era konekta root moduen | |
docker-compose exec -u root workspace bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment