force rebuild docker environment
When I attempt to force rebuild docker environment described at ansible-docker-initialize.en.md, it didn't seem to do so.
-
I noticed in initialize-docker-environment.py#L85,
SEED_FOCE
, a typo presumably, should beSEED_FORCE
; also, the equality check should be against text'1'
instead of number1
since env variables are treated as text. Suggested change:- if os.environ.get('SEED_FOCE') == 1: + if os.environ.get('SEED_FORCE') == '1':
-
Then I came across errors when the script is running
docker stop
:Traceback (most recent call last): File "./initialize-docker-environment.py", line 243, in <module> sys.exit(main()) File "./initialize-docker-environment.py", line 62, in main builder.build() File "./initialize-docker-environment.py", line 131, in build self.build_and_start_containers() File "./initialize-docker-environment.py", line 229, in build_and_start_containers self.build_container(name, ip) File "./initialize-docker-environment.py", line 190, in build_container result = subprocess(["docker", "stop", name]) TypeError: 'module' object is not callable
Suggested change around initialize-docker-environment.py#L189-L192 is to use
subprocess.run
instead ofsubprocess
:if self.container_is_running(name): - result = subprocess(["docker", "stop", name]) + result = subprocess.run(["docker", "stop", name]) if self.container_is_built(name): - result = subprocess(["docker", "rm", name]) + result = subprocess.run(["docker", "rm", name])
Thanks.