Create image (alpine version)+alpine

podman uses script and dockerfile to compile and install apache image

[root@localhost ~]# mkdir httpd 
[root@localhost ~]# cd httpd/ 
[root@localhost httpd]# touch Dockerfile 
[root@localhost httpd]# mkdir files 
[root@localhost httpd]# ls Dockerfile files

[root@localhost httpd]# cd files/ 
[root@localhost files]# wget 
[root@localhost files]# ls 
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz  
[root@localhost files]# vim
sed -i '/^#ServerName/s/#//g' /usr/local/apache/conf/httpd.conf 
exec "$@" 
[root@localhost files]# chmod +x

[root@localhost files]# cd .. 
[root@localhost httpd]# ls Dockerfile files 
[root@localhost httpd]# vim Dockerfile
FROM alpine


ENV apr_version=1.7.0 apr_util_version=1.6.1 httpd_version=2.4.54

ADD files/* /tmp/

RUN sed -i 's/' /etc/apk/repositories && \
    apk update && \
    adduser -SHs /sbin/nologin apache && \
    apk add --no-cache -U gcc libc-dev make expat-dev pcre-dev openssl-dev libtool && \
    cd /tmp/apr-${apr_version} && \
    sed -i '/$RM "$cfgfile"/d' configure && \
    ./configure --prefix=/usr/local/apr && \
    make && make install && \
    cd /tmp/apr-util-${apr_util_version} && \
    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && \
    make && make install && \
    cd /tmp/httpd-${httpd_version} && \
    ./configure --prefix=/usr/local/apache \
    --enable-so \
    --enable-ssl \
    --enable-cgi \
    --enable-rewrite \
    --with-zlib \
    --with-pcre \
    --with-apr=/usr/local/apr \
    --with-apr-util=/usr/local/apr-util/ \
    --enable-modules=most \
    --enable-mpms-shared=all \
    --with-mpm=prefork && \
    make && make install && \
    mv /tmp/ / && \
    apk del gcc make && \
    rm -rf /tmp/* /var/cache/*

WORKDIR /usr/local/apache
CMD ["/usr/local/apache/bin/httpd","-D","FOREGROUND"]
ENTRYPOINT ["/bin/sh","/"]
[root@localhost ~]# podman build -t marui123/httpd:v7.77 httpd/

[root@localhost ~]# podman push marui123/httpd:v7.77
Getting image source signatures
Copying blob 06a1df7414d4 done  
Copying blob 91f416cdf481 done  
Copying blob 994393dc58e7 skipped: already exists  
Copying config 4fedf5ad83 done  
Writing manifest to image destination
Storing signatures

1.0 Installation Media

Computer hardware, especially CPU s, come in several different architectures. A very common consumer architecture is called x86_64 - the traditional Intel x86 architecture with AMD's 64-bit extensions. If you're installing Alpine onto a traditional computer, this is most likely what you have. However, Alpine supports several other architectures for disk mounting purposes:
x86_64 Most common desktop, laptop and server architecture Older variant of x86x86_64, increasingly rare and limited to 4gb of RAMppc64le OpenPower based systems like IBM's POWER8s390xIBM Z (mainframe)
In some cases, you can also use the armhf and aarch64 architectures - 32-bit and 64-bit, respectively, associated with ARM chips, the latter possibly supporting UEFI.

Image Types Alpine offers a variety of downloadable images.
The types of images related to this manual are as follows:
Standard minimal installation image. Internet access required. Extends the standard, but includes additional packages. Fewer architectures are available, but may be more convenient. Typically used for non-disk installations. Netboot network boot image, designed to be used with PXE. Using PXE is beyond the scope of this manual, but can be used in place of a standard image. Virtual standard image, but with a different kernel, optimized for virtual environments. Xenon-specific image, designed for xen dom0 installations.
If you're not sure which image to use, you should use an extended image, provided your architecture is supported and the boot device is large enough. Otherwise, the standard image should be used.

2.0 Features

Features of the alpine system

  • Small: Based on Musl libc and busybox, it is as small as busybox, and the smallest Docker image is only 5MB;
  • Security: Lightweight distribution for security;
  • Simple: Provide APK package management tools, software search, installation, deletion, and upgrade are very convenient.
  • Suitable for container use: Due to its small size and complete functions, it is very suitable as a base image for containers.

2.0 Basic Commands

Order significance
apk update Update the latest mirror source list
apk search -v Find all available packages and their descriptions
apk search -v 'acf* Find packages by package name
apk search -v -d 'docke' Find specific packages by description file
apk add openssh install a software
apk add openssh openntp vim Install multiple software
apk add --no-cache mysql-client Not using the local mirror source cache is equivalent to executing update first and then add
apk info List all installed packages
apk info -a zlib Show complete package information
apk info --who-owns /sbin/lbu Displays the package to which the specified file belongs
apk upgrade Upgrade all software
apk upgrade openssh Upgrade specified software
apk upgrade openssh openntp vim Upgrade multiple software
apk add --upgrade busybox Specify to upgrade some packages
apk del openssh remove a software

3.0 mode

fast mode

  • Set keyboard layout
  • Initialize your hostname to the default "alpine" value
  • Set the primary (autodetected) interface to use DHCP and start networking
  • Enable various related system services and start them
  • Generate valid file /etc/hosts
  • Enable default repository


  • set root password
  • set time zone
  • Set up optional proxy
  • Enable SSH
  • Enable NTP synchronization
  • Configure disk (if any)
  • configure lbu
  • Configure the cache mechanism of apk

slower mode

  • You have a (current) physical disk and you want to install to that disk
  • Your primary network connection is wired and DHCP compatible
  • You don't care what bootloader or filesystem you use

Posted by deived on Wed, 31 Aug 2022 22:04:06 +0300