Skip to main content

docker sh -it

BUILDING DOCKERIFLES OVER AND OVER AGAIN WITH NO FEEDBACK AT ALL IS LIKE WEARING
THREE CONDOMS I'M TOO OLD FOR THIS SHIT I NEED TO TOUCH IT AND FEEL WHAT'S GOING
ON IN THERE OR I'LL LOSE INTEREST WHY CAN'T WE JUST CONNECT AND GET FEEDBACK AND
A RHYTHM GOING INSTEAD OF ALL THIS STOPPING AND STARTING IT'S REALLY OFF-PUTTING
AND NOT GOOD FOR ANYONE WHY NOT CONNECT TO THE CONTAINER THEN TYPE YOUR COMMANDS
IN AND WHEN THEY WORK THEY GET ADDED TO THE dOCKERFILE AND IF THEY DON'T THEY GO
IN AS COMMENTS OR SOMETHING AND IN THE BACKGROUND IT'S REBUILDING YOUR IMAGE AND
RECONNECTING READY FOR THE NEXT COMMAND OH AND HAVE IT WORK WITH THINGS LIKE add
AND copy AND STUFF THEN WHEN YOU'VE ACTUALLY GOT SOMETHING THAT WORKS YOU CAN GO
AND EDIT IT INTO SOMETHING THAT LOOKS MORE LIKE AN ACTUAL dOCKERFILE RATHER THAN
TRYING TO DO EVERYTHING UP-FRONT BEFORE YOU EVEN KNOW IF IT'S GONNA WORK INSTEAD
OF COMMUNICATING BY TELEGRAM MAYBE I SHOULD INSTALL DOCKERSHIT AND USE THAT YEAH
ITS PRETTY EASH YOU JUST TYPE `uvx dockershit` APPARENTLY AND IT'LL BE READY FOR
USE IN UNDER A SECOND AND WILL MOSTLY WORK BUT MIGHT BE BUGGY BECAUSE ITS NEWISH
AND THE DEVELOPER WROTE IT IN ANGER AND DOESN'T SEEM TO TAKE IT SERIOUSLY BUT IT
IS WORTH A TRY BECAUSE IF YOU WASTE TIME HERE AT LEAST IT IS WASTED DIFFERENTLY.

Usage

Quickest way is run it in uv (either pip install uv or follow their instructions). Or use pip install dockershit or pipx dockershit. It's on pypi.

⚠️ IT EDITS DOCKERFILES SO USE SOURCE CONTROL ⚠️

By default it'll create or append to a Dockerfile in your pwd. Each proposed instruction is tested as a transaction: if it breaks the build, the previous file is restored byte-for-byte before the failed instruction is added as a comment. Don't say you weren't warned.

uvx dockershit ubuntu:latest

It uses Podman when available, falling back to Docker. Choose one explicitly with --engine podman or --engine docker.

  • 🔢 type some commands, then exit or quit
  • 👀 look in your pwd for a Dockerfile, notice the RUN lines - they're the commands that worked (zero exit code)
  • 💣 commands that failed or made no changes are commented out
  • 🔃 arrow keys and ctrl+r work, history is in Dockerfile.history
  • ⬅️ commands starting with a space don't get added to the file, but they do go to the .history file
  • 💬 comments e.g. # wtf delete the above go to the Dockerfile unless they start with a space i.e. # subscribe and like, like and subscribe
  • ADD, COPY and other docker shit get added too, and the image is rebuilt between each command
  • #️⃣ if a command fails, you'll get a commented out line instead
  • 🚶 cd changes your WORKDIR, and WORKDIR changes your cd
  • 🐛 use --debug if you want to see it rebuilding
  • 💥 if an instruction breaks the build, it restores the previous Dockerfile
  • 🚫 your Dockerfile and its history are excluded from the context
  • 🪈 you can use it with pipe like cat whatever | dockershit
  • 💩 yeah it runs everything twice, which is an embarrassment - in future I'll make it just run in docker, but pull requests are welcome

License

WTFPL with one additional clause:

  1. Don't blame me!

Links

TODO

  • restructure input so it's a nice UI
    • use textual?
  • remove double WORKDIR entries by combining them
  • deal with ENV and ARG - passing them in on the command line.
  • add DS commands or whatever it ends up being called
    • use argparse
    • edit, to edit the current file (in git editor?)
    • squash, combine run steps with && \

Release files for dockershit 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dockershit 0.2.1
File Size Uploaded
dockershit-0.2.1.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dockershit 0.2.1
File Interpreter ABI Platform
dockershit-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 21.8 kB

Release files / dockershit-0.2.1.tar.gz

Download URL dockershit-0.2.1.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
93ce5fb1a31eed9c990a52a6a926de2b1f0576fe09ba1d2b33841b1a08e0956f
BLAKE2b-256 checksum
How to use checksums
9a1daa1d97817c221d3d1e9af30a971932bca80620e6d4805f52693bdb347d22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / dockershit-0.2.1-py2.py3-none-any.whl

Download URL dockershit-0.2.1-py2.py3-none-any.whl
Size 11.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d77e3c8c9086035e9e51afcd2e7e615eb08b9139fa8b1f6f436383eb42cf769b
BLAKE2b-256 checksum
How to use checksums
f39acae90e6adf30b91e9802e54f6d9107e2e202dcccb5a37c5650ace42a368c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page