Docker: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Links == * [https://github.com/alpinelinux/docker-alpine Docker-Alphine (github)] — A lightweight debian/ubuntu-like image (5MB) == Install == * [https://docs.docker...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
* [https://docs.docker.com/engine/install/debian/ Docker - Install on Debian]. |
* [https://docs.docker.com/engine/install/debian/ Docker - Install on Debian]. |
||
* [https://docs.docker.com/engine/install/linux-postinstall/ Docker - PostInstall (run as non-root)]. |
* [https://docs.docker.com/engine/install/linux-postinstall/ Docker - PostInstall (run as non-root)]. |
||
Examples: |
|||
* https://akashrajpurohit.com/blog/build-your-own-docker-with-linux-namespaces-cgroups-and-chroot-handson-guide/ |
|||
== Tips == |
== Tips == |
||
Line 14: | Line 17: | ||
apk add 'packagename<1.2.3-suffix' |
apk add 'packagename<1.2.3-suffix' |
||
</source> |
</source> |
||
=== Install pip3 === |
|||
Installing {{deb|python3-dev}} in Alpine we get the error <code>pip3: not found</code> |
|||
<source lang="bash"> |
|||
RUN apk add --no-cache python3 openssl ca-certificates git openssh sshpass |
|||
&& apk --update add --virtual build-dependencies python3-dev libffi-dev openssl-dev build-base |
|||
&& pip3 install --upgrade pip cffi |
|||
# ... |
|||
# Error: |
|||
# /bin/sh: pip3: not found |
|||
# ERROR: Job failed: exit code 127 |
|||
</source> |
|||
* The workaround is to add <code>py-pip</code> library. |
|||
* Recommended solution [https://github.com/alpinelinux/docker-alpine/issues/91] is to run <code>apk add cmd:pip3</code>, which will pull whatever package that provides <code>pip3</code>. |
|||
=== Don't use Alpine for Python build === |
|||
* From https://pythonspeed.com/articles/alpine-docker-python/ |
|||
* Because Alpine uses <code>musl</code> instead of <code>glibc</code>. |
Latest revision as of 10:30, 27 June 2023
Links
- Docker-Alphine (github) — A lightweight debian/ubuntu-like image (5MB)
Install
Examples:
Tips
Alpine - Install a specific package version
From SuperUser:
# Both are equal
apk add packagename=1.2.3-suffix
apk add 'packagename<1.2.3-suffix'
Install pip3
Installing python3-dev in Alpine we get the error pip3: not found
RUN apk add --no-cache python3 openssl ca-certificates git openssh sshpass
&& apk --update add --virtual build-dependencies python3-dev libffi-dev openssl-dev build-base
&& pip3 install --upgrade pip cffi
# ...
# Error:
# /bin/sh: pip3: not found
# ERROR: Job failed: exit code 127
- The workaround is to add
py-pip
library. - Recommended solution [1] is to run
apk add cmd:pip3
, which will pull whatever package that providespip3
.
Don't use Alpine for Python build
- From https://pythonspeed.com/articles/alpine-docker-python/
- Because Alpine uses
musl
instead ofglibc
.