til: docker_test-fedora-in-docker.md
This data as json
| path | topic | title | url | body | html | shot | created | created_utc | updated | updated_utc | shot_hash | slug |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| docker_test-fedora-in-docker.md | docker | Testing things in Fedora using Docker | https://github.com/simonw/til/blob/main/docker/test-fedora-in-docker.md | I got [a report](https://twitter.com/peterjanes/status/1552407491819884544) of a bug with my [s3-ocr tool](https://simonwillison.net/2022/Jun/30/s3-ocr/) running on Fedora. I attempted to replicate the bug in a Fedora container using Docker, by running this command: ``` docker run -it fedora:latest /bin/bash ``` This downloaded [the official image](https://hub.docker.com/_/fedora) and dropped me into a Bash shell. It turns out Fedora won't let you run `pip install` with its default Python 3 without first creating a virtual environment: ``` [root@d1146e0061d1 /]# python3 -m pip install s3-ocr /usr/bin/python3: No module named pip [root@d1146e0061d1 /]# python3 -m venv project_venv [root@d1146e0061d1 /]# source project_venv/bin/activate (project_venv) [root@d1146e0061d1 /]# python -m pip install s3-ocr Collecting s3-ocr Downloading s3_ocr-0.5-py3-none-any.whl (14 kB) Collecting sqlite-utils ... ``` Having done that I could test out my `s3-ocr` command like so: ``` (project_venv) [root@d1146e0061d1 /]# s3-ocr start --help Usage: s3-ocr start [OPTIONS] BUCKET [KEYS]... Start OCR tasks for PDF files in an S3 bucket s3-ocr start name-of-bucket path/to/one.pdf path/to/two.pdf ... ``` | <p>I got <a href="https://twitter.com/peterjanes/status/1552407491819884544" rel="nofollow">a report</a> of a bug with my <a href="https://simonwillison.net/2022/Jun/30/s3-ocr/" rel="nofollow">s3-ocr tool</a> running on Fedora.</p> <p>I attempted to replicate the bug in a Fedora container using Docker, by running this command:</p> <pre><code>docker run -it fedora:latest /bin/bash </code></pre> <p>This downloaded <a href="https://hub.docker.com/_/fedora" rel="nofollow">the official image</a> and dropped me into a Bash shell.</p> <p>It turns out Fedora won't let you run <code>pip install</code> with its default Python 3 without first creating a virtual environment:</p> <pre><code>[root@d1146e0061d1 /]# python3 -m pip install s3-ocr /usr/bin/python3: No module named pip [root@d1146e0061d1 /]# python3 -m venv project_venv [root@d1146e0061d1 /]# source project_venv/bin/activate (project_venv) [root@d1146e0061d1 /]# python -m pip install s3-ocr Collecting s3-ocr Downloading s3_ocr-0.5-py3-none-any.whl (14 kB) Collecting sqlite-utils ... </code></pre> <p>Having done that I could test out my <code>s3-ocr</code> command like so:</p> <pre><code>(project_venv) [root@d1146e0061d1 /]# s3-ocr start --help Usage: s3-ocr start [OPTIONS] BUCKET [KEYS]... Start OCR tasks for PDF files in an S3 bucket s3-ocr start name-of-bucket path/to/one.pdf path/to/two.pdf ... </code></pre> | <Binary: 69,527 bytes> | 2022-07-27T15:41:43-07:00 | 2022-07-27T22:41:43+00:00 | 2022-07-27T15:41:43-07:00 | 2022-07-27T22:41:43+00:00 | 5a2832241e5fe9b2ff76ad09099e73ae | test-fedora-in-docker |