Skip to content

Commit 4d5bef9

Browse files
authored
Merge pull request #19730 from edsantiago/you_say_hello_and_i_say_goodbye
Revert "Remove `hello` multi-arch image build"
2 parents 7c0e926 + 70f77ef commit 4d5bef9

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

.cirrus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,8 @@ image_build_task: &image-build
962962
CTXDIR: contrib/podmanimage/testing
963963
- env:
964964
CTXDIR: contrib/podmanimage/stable
965+
- env:
966+
CTXDIR: contrib/hello
965967
env:
966968
DISTRO_NV: "${FEDORA_NAME}" # Required for repo cache extraction
967969
PODMAN_USERNAME: ENCRYPTED[b9f0f2550029dd2196e086d9dd6c2d1fec7e328630b15990d9bb610f9fcccb5baab8b64a8c3e72b0c1d0f5917cf65aa1]

contrib/hello/Containerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM docker.io/alpine as builder
2+
RUN apk add gcc libc-dev
3+
ADD podman_hello_world.c .
4+
RUN gcc -O2 -static -o podman_hello_world podman_hello_world.c
5+
6+
FROM scratch
7+
LABEL maintainer="Podman Maintainers"
8+
LABEL artist="Máirín Ní Ḋuḃṫaiġ, Twitter:@mairin"
9+
USER 1000
10+
COPY --from=builder podman_hello_world /usr/local/bin/podman_hello_world
11+
CMD ["/usr/local/bin/podman_hello_world"]

contrib/hello/README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
![PODMAN logo](https://raw.githubusercontent.com/containers/common/main/logos/podman-logo-full-vert.png)
2+
3+
# Podman Hello World image
4+
5+
## Overview
6+
7+
This directory contains the Containerfile and bash script necessary to create the
8+
"hello" podman image housed on quay.io under the Podman account in a public
9+
repository. The image is public and can be pulled without credentials.
10+
11+
Using this image is helpful to:
12+
13+
* Prove that basic Podman operations are working on the host.
14+
* Shows that the image was pulled from the quay.io container registry.
15+
* Container creation was successfully accomplished. (`podman ps -a`)
16+
* The created container was able to stream output to your terminal.
17+
18+
## Directory Contents
19+
20+
The contents of this directory contain:
21+
* ./Containerfile
22+
* ./podman_hello_world.c
23+
24+
## Sample Usage
25+
26+
To simply run the image:
27+
28+
```
29+
podman run quay.io/podman/hello
30+
31+
!... Hello Podman World ...!
32+
33+
.--"--.
34+
/ - - \
35+
/ (O) (O) \
36+
~~~| -=(,Y,)=- |
37+
.---. /` \ |~~
38+
~/ o o \~~~~.----. ~~
39+
| =(X)= |~ / (O (O) \
40+
~~~~~~~ ~| =(Y_)=- |
41+
~~~~ ~~~| U |~~
42+
43+
Project: https://github.com/containers/podman
44+
Website: https://podman.io
45+
Documents: https://docs.podman.io
46+
Twitter: @Podman_io
47+
```
48+
To build the image yourself, copy the files from this directory into
49+
a local directory and issue these commands:
50+
51+
```
52+
podman build -t myhello .
53+
podman run myhello
54+
```
55+
56+
## Potential Issues:
57+
58+
The image runs as a rootless user with the UID set to `1000`.
59+
If the /etc/subuid and /etch/subgid values are not set appropriately to run as a
60+
rootless user on the host, an error like this might be raised:
61+
62+
```
63+
Copying blob acab339ca1e8 done
64+
ERRO[0002] Error while applying layer: ApplyLayer exit status 1 stdout: stderr: potentially insufficient UIDs or GIDs available in user namespace (requested 0:12 for /var/spool/mail): Check /etc/subuid and /etc/subgid: lchown /var/spool/mail: invalid argument
65+
Error: writing blob: adding layer with blob "sha256:ee0cde9de8a68f171a8c03b0e9954abf18576947e2f3187e84d8c31ccd8f6a09": ApplyLayer exit status 1 stdout: stderr: potentially insufficient UIDs or GIDs available in user namespace (requested 0:12 for /var/spool/mail): Check /etc/subuid and /etc/subgid: lchown /var/spool/mail: invalid argument
66+
```
67+
68+
Please refer to this [blog post](https://www.redhat.com/sysadmin/rootless-podman) for further configuration information.
69+
70+
## THANKS!
71+
72+
Many Thanks to @afbjorklund for a great discussion during the
73+
first revision of this container image that resulted in moving
74+
from using bash to using C, and the ensuing changes to the
75+
Containerfile.
76+
77+
Also many thanks to @mairin for the awesome ASCII art!

contrib/hello/podman_hello_world.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//###
2+
// ASCII art by the incomparable Máirín Duffy,
3+
// [email protected], Twitter: @mairin
4+
// January 2022
5+
//###
6+
7+
#include <stdio.h>
8+
int main() {
9+
puts("\
10+
!... Hello Podman World ...!\n\
11+
\n\
12+
.--\"--. \n\
13+
/ - - \\ \n\
14+
/ (O) (O) \\ \n\
15+
~~~| -=(,Y,)=- | \n\
16+
.---. /` \\ |~~ \n\
17+
~/ o o \\~~~~.----. ~~ \n\
18+
| =(X)= |~ / (O (O) \\ \n\
19+
~~~~~~~ ~| =(Y_)=- | \n\
20+
~~~~ ~~~| U |~~ \n\
21+
\n\
22+
Project: https://github.com/containers/podman\n\
23+
Website: https://podman.io\n\
24+
Documents: https://docs.podman.io\n\
25+
Twitter: @Podman_io");
26+
}

0 commit comments

Comments
 (0)