正文開始:
sudo usermod -aG docker $USER
就這麼一行可以省去每次加 sudo 總共五個字的麻煩。
觀眾們,摳過去用吧~~
sudo usermod -aG docker $USER
import threading
import time
def process_1():
counter = 0
t = threading.currentThread()
while getattr(t, "loop_alive", True):
print('process_1counter:', counter)
counter += 1
time.sleep(1)
if counter > 80:
break
print('process_1 thread stop')
p1_thread = threading.Thread(target=p2, args=())
p1_thread.start()
time.sleep(10)
p1_thread.loop_alive = False