<html><head>

<style id="signatureStyle" type="text/css"><!--#x139c83d43612493 #x8ab559e4cb4f4443b6a55a8eaaaf9fab:empty::before
{content: attr(placeholder); color: lightgrey;}
#x139c83d43612493 #x8ab559e4cb4f4443b6a55a8eaaaf9fab
{font-family: "Segoe UI"; font-size: 12pt;}
#x139c83d43612493 #x8ab559e4cb4f4443b6a55a8eaaaf9fab
{font-family: "Segoe UI"; font-size: 12pt;}
#x139c83d43612493 #x8ab559e4cb4f4443b6a55a8eaaaf9fab
{background-color: rgb(35, 37, 35); color: rgb(210, 210, 210); margin: 8px;}
#x139c83d43612493 #x8ab559e4cb4f4443b6a55a8eaaaf9fab:empty::before
{content: attr(placeholder); color: lightgrey;}
#x139c83d43612493 #x8ab559e4cb4f4443b6a55a8eaaaf9fab
{background-color: rgb(35, 37, 35); color: rgb(210, 210, 210); margin: 8px;}
#x139c83d43612493 #x8ab559e4cb4f4443b6a55a8eaaaf9fab:empty::before
{content: attr(placeholder); color: lightgrey;}
--></style><style id="css_styles" type="text/css"><!--blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
table { border-collapse: collapse; }
li[style='text-align: center;'], li[style='text-align: center; '], li[style='text-align: right;'], li[style='text-align: right; '] {  list-style-position: inside;}
body { font-family: 'Segoe UI'; font-size: 12pt; }
.quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb solid; padding-left: 0.3em; }
--></style></head>
<body><div>Leam,</div><div>I've run into the same issues... I just could not get systemctl enable and start commands to work.  Here is the final docker file that works. I added yum update.</div><div><br /></div><div>FROM amazonlinux:latest
</div><div>RUN yum update -y
</div><div>RUN yum install -y iproute sysstat procps-ng httpd
</div><div>EXPOSE 80
</div><div>CMD ["httpd","-D","FOREGROUND"]
</div><div><br /></div><div><br /></div><div>I suggest also adding the docker run example to your HOWTO.</div><div><br /></div><div>docker run --name amzl_web -p 8080:80 docker.io/library/amzl_web</div>
<div><br /></div><div id="signature_old" style="clear:both"><div id="x139c83d43612493"><div><br /></div><div><div id="x8ab559e4cb4f4443b6a55a8eaaaf9fab"><div>Regards,</div><div>Mark Ulmer</div></div></div></div></div><div style="clear:both"><br /></div>
<div><br /></div>
<div>
<div>------ Original Message ------</div>
<div>From "Leam Hall via Ale" <<a href="mailto:ale@ale.org">ale@ale.org</a>></div>
<div>To "Atlanta Linux Enthusiasts" <<a href="mailto:ale@ale.org">ale@ale.org</a>></div>
<div>Cc "Leam Hall" <<a href="mailto:leamhall@gmail.com">leamhall@gmail.com</a>></div>
<div>Date 6/29/2024 9:09:08 AM</div>
<div>Subject [ale] Would you mind critiquing a container build HOWTO?</div></div><div><br /></div>
<div id="xf534d2dd9d2648d" class="plain"><blockquote cite="e1409e77-0976-069b-9ca3-771ec87b1bb7@gmail.com" type="cite" class="cite2">

<div class="plain_line">Hey container-savvy peeps, would you mind critiquing a short HOWTO (below) on getting an Amazon Linux container to run locally? I'm doing some AWS study and want to put together a more concise document that will let folks try out AWS without having to reroute through a dozen documents to resolve basic tasks.</div>
<div class="plain_line"> </div>
<div class="plain_line">Thanks!</div>
<div class="plain_line"> </div>
<div class="plain_line">Leam</div>
<div class="plain_line">-- Site Reliability Engineer  (reuel.net/resume)</div>
<div class="plain_line">Scribe: The Domici War     (domiciwar.net)</div>
<div class="plain_line">General Ne'er-do-well      (github.com/LeamHall)</div>
<div class="plain_line"> </div>
<div class="plain_line"> </div>
<div class="plain_line"> </div>
<div class="plain_line"> </div>
<div class="plain_line">My hypothesis is that running Amazon Linux in EC2 would be more performant than other Linux versions because the AWS engineers could tune their OS distribution to their platform.</div>
<div class="plain_line"> </div>
<div class="plain_line">To test, I began by building an Amazon Linux container locally. This would allow investigating the OS itself, and then knowing how to configure it for use and observability. This quickly ran into the issue of portablity, while Amazon does have a container image on the Docker Hub, it doesn't run in standalone mode and it is missing basic sysadmin tools like "ps".</div>
<div class="plain_line"> </div>
<div class="plain_line">So far a kludge resolves the stand-alone issue, but I'd like to find a better solution. Here's the annotated Dockerfile and commands used.</div>
<div class="plain_line"> </div>
<div class="plain_line"> </div>
<div class="plain_line">FROM amazonlinux:latest                                 (1)</div>
<div class="plain_line">RUN yum install iproute sysstat procps-ng httpd -y      (2)(6)(7)(8)(9)</div>
<div class="plain_line"># RUN httpd -k start                                    (3)</div>
<div class="plain_line"># RUN systemctl start httpd                             (4)</div>
<div class="plain_line">ENTRYPOINT ["/usr/sbin/httpd"]                                (5)</div>
<div class="plain_line">CMD ["-DFOREGROUND"]</div>
<div class="plain_line"> </div>
<div class="plain_line"> </div>
<div class="plain_line">(1)  <a href="https://docs.aws.amazon.com/linux/al2023/ug/base-container.html">https://docs.aws.amazon.com/linux/al2023/ug/base-container.html</a></div>
<div class="plain_line">(2)  Adding some observability tools and httpd to keep the thing up.</div>
<div class="plain_line">(3)  This just exits out.</div>
<div class="plain_line">(4)  This fails with:</div>
<div class="plain_line">        > [3/4] RUN systemctl start httpd:</div>
<div class="plain_line">        0.976 System has not been booted with systemd as init system (PID 1). Can't operate.</div>
<div class="plain_line">        0.976 Failed to connect to bus: Host is down</div>
<div class="plain_line">(5)  This ENTRYPOINT and CMD pair works.</div>
<div class="plain_line">(6)  iproute gives the "ip" command.</div>
<div class="plain_line">(7)  sysstat gives the sar, pidstat, vmstat, iostat, and mpstat commands.</div>
<div class="plain_line">(8)  procps-ng gives the "ps" command.</div>
<div class="plain_line">(9)  httpd is required to have a running process, otherwise the container shuts down.</div>
<div class="plain_line"> </div>
<div class="plain_line"> </div>
<div class="plain_line">Commands:</div>
<div class="plain_line"> </div>
<div class="plain_line">Get the container image (<a href="https://hub.docker.com/_/amazonlinux">https://hub.docker.com/_/amazonlinux</a>).</div>
<div class="plain_line">        docker pull amazonlinux</div>
<div class="plain_line"> </div>
<div class="plain_line">In the directory with the Dockerfile. Note the ending ".".</div>
<div class="plain_line">        docker build -t amzl_web .</div>
<div class="plain_line"> </div>
<div class="plain_line">You must also start it with "&" to regain your terminal window.</div>
<div class="plain_line">        docker run amzl_web &</div>
<div class="plain_line"> </div>
<div class="plain_line">Connect to the container.</div>
<div class="plain_line">        docker exec -it <container_name> /bin/bash</div>
<div class="plain_line"> </div>
<div class="plain_line">_______________________________________________</div>
<div class="plain_line">Ale mailing list</div>
<div class="plain_line"><a href="mailto:Ale@ale.org">Ale@ale.org</a></div>
<div class="plain_line"><a href="https://mail.ale.org/mailman/listinfo/ale">https://mail.ale.org/mailman/listinfo/ale</a></div>
<div class="plain_line">See JOBS, ANNOUNCE and SCHOOLS lists at</div>
<div class="plain_line"><a href="http://mail.ale.org/mailman/listinfo">http://mail.ale.org/mailman/listinfo</a></div>
</blockquote></div>


</body></html>