Skip to content

Commit

Permalink
adds DooD support
Browse files Browse the repository at this point in the history
  • Loading branch information
dmalan committed Jan 29, 2024
1 parent 91551b3 commit f2ac79a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion cli50/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def main():
"--security-opt", "seccomp=unconfined", # https://stackoverflow.com/q/35860527#comment62818827_35860527, https://github.com/apple/swift-docker/issues/9#issuecomment-328218803
"--tty",
"--volume", directory + ":" + workdir,
"--volume", "/var/run/docker.sock:/var/run/docker-host.sock", # https://github.com/devcontainers/features/blob/main/src/docker-outside-of-docker/devcontainer-feature.json
"--workdir", workdir]

# Check for locale
Expand Down Expand Up @@ -259,14 +260,19 @@ def main():
["--publish-all"] +
[f"{IMAGE}:{args['tag']}"] + cmd).decode("utf-8").rstrip()

# Start Docker-outside-of-Docker
# a la https://github.com/devcontainers/features/blob/main/src/docker-outside-of-docker/install.sh
subprocess.check_output(["docker", "exec", container, "sudo", "/etc/init.d/docker", "start"])

# List port mappings
print(ports(container))

# Let user interact with container
print(subprocess.check_output(["docker", "logs", container]).decode("utf-8"), end="")
subprocess.call(["docker", "attach", container])

except subprocess.CalledProcessError:
except subprocess.CalledProcessError as e:
print(e.output)
sys.exit(1)
else:
sys.exit(0)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"console_scripts": ["cli50=cli50.__main__:main"]
},
url="https://github.com/cs50/cli50",
version="7.4.1",
version="7.5.0",
include_package_data=True
)

0 comments on commit f2ac79a

Please sign in to comment.