Skip to content

Instantly share code, notes, and snippets.

@slashtechno
Created August 10, 2022 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slashtechno/809e2bbf1984d4380c0d5dfe2ddc40d2 to your computer and use it in GitHub Desktop.
Save slashtechno/809e2bbf1984d4380c0d5dfe2ddc40d2 to your computer and use it in GitHub Desktop.
Simple usage of python-on-whales (https://github.com/gabrieldemarmiesse/python-on-whales)
from python_on_whales import docker
output = docker.run(image="ubuntu", detach=True, tty=True, interactive=True, publish=[(80, 80), (8080, 8080)], name = "hello", remove=True)
# Both are equal
print(output)
print(docker.container.inspect(output))
docker.container.execute(container = output, command = "bash", tty=True, interactive=True)
docker.container.remove(output, force=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment