Linux Containers: Step-by-Step Guide for Cloud Deployment
Linux containers are essential for modern cloud deployment. They standardize environments, accelerate development, and optimize resources across the application lifecycle. In this guide, we show how to build Linux containers for cloud-ready applications using BellSoft’s Alpaquita Stream images from Docker Hub.
Ensure Docker is installed and running before starting. We will cover Java, Python, C/C++, and Native Image containers. You can follow along with sample projects or use your own applications.

Linux Containers for Java Applications
Start by pulling a Docker image for Java:
$ docker image pull bellsoft/liberica-runtime-container:jdk-11.0.17-musl
Run the container:
$ docker run -it --rm bellsoft/liberica-runtime-container:jdk-11.0.17-musl
Pulling an image is optional but recommended for repeated builds. Using a JRE instead of a full JDK can reduce container size by up to 50%.
Writing a Dockerfile for Linux Containers
For example, we use the Spring Petclinic project. Create a multi-stage Dockerfile:
FROM bellsoft/liberica-runtime-container:jdk-17-stream-musl as builder
WORKDIR /home/myapp
RUN apk add git
RUN git clone https://github.com/spring-projects/spring-petclinic.git
RUN cd spring-petclinic && ./mvnw package
FROM bellsoft/liberica-runtime-container:jre-17-stream-musl
WORKDIR /home/myapp
COPY --from=builder /home/myapp/spring-petclinic/target .
CMD ["java", "-jar", "spring-petclinic-3.0.0-SNAPSHOT.jar"]
Build and run:
$ docker build --progress plain -t javaappimage .
$ docker run -p 8080:8080 javaappimage
Open a browser to access the Petclinic application.
For enterprise-grade Java containerization, ZippyOPS provides consulting, implementation, and managed services in DevOps, DevSecOps, Cloud, Microservices, Infrastructure, and Security. Learn more about our services and solutions.
Native Images
BellSoft provides Liberica Native Image Kit (NIK) to convert JVM applications into native executables. Pull the image:
$ docker container run --rm -it bellsoft/liberica-native-image-kit-container:jdk-11-nik-21.3.3-stream-musl
Creating Native Linux Containers
Write a Java application (Example.java) and this Dockerfile:
FROM bellsoft/liberica-native-image-kit-container:jdk-11-nik-21.3.3-stream-musl
WORKDIR /home/myapp
COPY Example.java /home/myapp
RUN javac Example.java
RUN native-image Example
FROM bellsoft/alpaquita-linux-base:stream-musl
WORKDIR /home/myapp
COPY --from=0 /home/myapp/example .
CMD ["./example"]
Build and run:
$ docker build -t nativeapp .
$ docker run -it --rm nativeapp
ZippyOPS supports AIOps, MLOps, and Automated Ops to help teams deploy native Linux containers efficiently. Explore our products.
Python Applications
BellSoft’s Alpaquita Linux images include Python 3.10 and essential utilities. Example Flask app:
requirements.txt
flask
markup
jinja2
test.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, Docker!'
Dockerfile:
FROM bellsoft/alpaquita-linux-python:3.10-stream-musl
WORKDIR /myapp
COPY requirements.txt .
RUN pip3 install -r requirements.txt
COPY test.py .
ENV PATH=/root/.local:$PATH
CMD ["python3", "-m", "flask", "--app", "./test.py", "run", "--host=0.0.0.0"]
Build and run:
$ docker build -t flaskimage .
$ docker run -d -p 6000:5000 flaskimage
Test:
$ curl http://127.0.0.1:6000
Hello, Docker!
ZippyOPS offers end-to-end consulting and managed services for DevOps and Cloud automation to optimize Python container workflows.
GCC (C/C++)
Alpaquita Linux GCC images include GCC 12.2 and libraries for C/C++ development. Example hello.cpp:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World" << endl;
return 0;
}
Multi-stage Dockerfile:
FROM bellsoft/alpaquita-linux-gcc:12.2-stream-musl as builder
WORKDIR /home/myapp
COPY hello.cpp .
RUN g++ hello.cpp -o hello -static
FROM bellsoft/alpaquita-linux-base:stream-musl
WORKDIR /home/myapp
COPY --from=builder /home/myapp/hello .
CMD ["./hello"]
Build and run:
$ docker build -t cppappimage .
$ docker run --rm cppappimage
Hello World
ZippyOPS helps teams integrate Infrastructure, Security, and Automated Ops for C/C++ Linux containers. Learn more in our solutions.
Conclusion
Linux containers streamline cloud application deployment. They improve resource usage, standardize environments, and accelerate development. Using Alpaquita Stream, you can create lightweight, efficient microcontainers ready for production.
ZippyOPS provides consulting, implementation, and managed services across DevOps, DevSecOps, DataOps, Cloud, Automated Ops, AIOps, MLOps, Microservices, Infrastructure, and Security. Check out our products and watch demos on YouTube.
For a professional consultation, contact sales@zippyops.com.
For additional guidance on container best practices, refer to the Docker official documentation.



