days left for your 2X growth
 / 

2X Growth

2X the points gained during the growth doubling period

Points

Get points: use points for successful completion of experiments, challenges and learning route courses:points can unlock advanced features such as: discovery mode, schedule experiments, extended experiments, VIP experiments, etc.

Number of active activities

Each time you complete an experiment, challenge, or course, you increase the number of active activities to earn a higher level

The system detects that you've not completed the task
Quick path - Complete any of the following experiments
You can
Unlock more experiment and learn path
Schedule experiment and access the discovery mode
Get your own experiment environment with VIP authority
2X Growth Points
News about the latest experiment, learning path and other events information.
You have Bonus Task(s) awaiting completion.
Bonus task list
Preference Setting

Save

Heterogeneous Building of Host Container Images (LinuxONE or zCX) -

Quickly Build Host Container Images on a x86 Platform (LinuxONE or zCX)

Only    0 seat(s) available

    0 already completed

Experiment: Quickly Build Host Container Images on a x86 Platform (LinuxONE or zCX)

111 already completed

Experiment Content:

Experiment Resources:

Medal Status


Lighten Medals

Latest Activites

zhoufc

has completed the experiment and received a blue medal

chenjian

has completed the experiment and received a blue medal

739163912

has completed the experiment and received a blue medal

739163912

has completed the experiment and received a blue medal

739163912

has completed the experiment and received a blue medal

739163912

has completed the experiment and received a blue medal

syyjcyao

has completed the experiment and received a blue medal

syyjcyao

has completed the experiment and received a blue medal

yanqingc

has completed the experiment and received a blue medal

yanqingc

has completed the experiment and received a blue medal

Discovery:Quickly Build Host Container Images on a x86 Platform (LinuxONE or zCX)

2 already completed

Experiment Content:

Experiment Resources:

Tips

1. Discovery provides longer time for your experience;you are home free
2. Data will be cleared after the end of discovery
3. It is needed to finish the experiment and challenge first to start your discovery

Please start your challenge after you finish the experiment

Please start your discovery after you finish the challenge.

Please start your discovery after you finish the experiment.

Experiment Manual

The following content is displayed on the same screen for your experiment so that you can make any necessary reference in experiment. Start your experiment now!

  1. Introduction to Docker Multi-arch Cross-platform Building(Duration: 5 mins)

    You are an IT manager. Recently, the data center under your management purchased a batch of LinuxONE machines, and you need to quickly migrate the container applications on the x86 platform to the LinuxONE platform. Therefore, you come to this Online Lab for learning and performing the experiment: 
    (This experiment is also applicable for: Quickly migrate container applications on a x86 platform to a z/OS Container Extensions environment)
     
    The emergence of container technology and Docker Multi-arch cross-platform container technology has addressed the strong coupling relationship between the application system and the supporting hardware environment of the middleware system to a very large extent, and has replaced virtual machines and become an important support for cloud native systems.

    Meanwhile, although container technology Docker and the host share the kernel, its underlying implementation mechanism (NameSpace + ControlGroup + UnionFileSystem) still relies on Linux and the underlying hardware platform. As a result, one application has to use different Docker images on different hardware platforms, which need to be separately built on different hardware platforms, causing increases in environment complexity and the workload of continuous integration (CI) in DevOps.

    Docker Multi-arch cross-platform building solves this problem. You can build Docker Images on the ARM platform and the LinuxONE platform on a x86 platform. (https://github.com/multiarch/qemu-user-static/)

    Therefore, they can share the same continuous integration pipeline (CI Pipeline) with x86 Docker Images, which not only simplify the environment and process, but also improve the quality and efficiency of delivery.


    The above s390x medium is suitable for a LinuxONE platform environment or a z/OS Container Extensions environment.
     
    In this online experiment, we will integrate a docker image of s390x on the x86 platform quickly based on an existing x86 Docker Image sample with this cross-platform building feature.

  2. Log into the experimental environment, and then view and run the existing x86 Docker Image building sample(Duration: 8 mins)

    Enter  uname -a  and you will see the local x86 Linux, as shown below:

    Linux cscdemo-virtual-machine 5.3.0-53-generic #47~18.04.1-Ubuntu SMP Thu May 7 13:10:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


    Enter  cd ~/multiarch to enter the multiarch directory.


    Check the Python code of the sample. The output of this sample is the hardware platform where the docker is running.
    Enter  cat src/hello.py  and the output is shown in the following figure.

    import platform
    from flask import Flask
    app = Flask(__name__)
    
    @app.route("/")
    def hello():
        return "<h1><b>HELLO from %s</b></h1>" % platform.uname()[4]
    
    if __name__ == "__main__":
        app.run(host="0.0.0.0")
     


    Check the dockerfile, which is the definition file for the Docker image running on the x86 platform.
    Enter  cat Dockerfile and the output is shown in the following figure.

    FROM python:3.7-alpine as base
    FROM base as builder
    
    RUN mkdir /install
    WORKDIR /install
    
    COPY requirements.txt /requirements.txt
    RUN pip install --install-option="--prefix=/install" -r /requirements.txt
    
    FROM base
    
    COPY --from=builder /install /usr/local
    COPY src /app
    
    WORKDIR /app
    
    ENTRYPOINT [ "python" ]
    CMD [ "hello.py" ]
     


    View the building and running script: dockerBldRun.sh.
    Enter  cat dockerBldRun.sh  
    and the output is shown in the following figure.

    echo "docker build x86"
    docker build -t `whoami`/multiarch:latest .
    
    #echo "docker push"
    #docker push fanzh8docker/ci:latest
    
    echo "run sample on x86"
    sudo docker run --name `whoami` -p 5000:5000 `whoami`/multiarch:latest
     


    Run and check the output of docker running output.
    Enter ./dockerBldRun.sh


    Open the browser and enter address http://0.0.0.0:5000, and the following output will be generated: We can see that this application is running on the x86 hardware.

     

    Get back to the command line interface and exit from the current script with the key combination Ctrl+C

  3. Build LinuxONE Docker Image quickly and run tests(Duration: 12 mins)

    (1) Check Dockerfile.s390x.
    Enter cat Dockerfile and cat Dockerfile.s390x

    FROM python:3.7-alpine as base
    FROM base as builder
    
    RUN mkdir /install
    WORKDIR /install

     

    FROM s390x/python:3.7-alpine as base
    FROM base as builder
    
     COPY qemu-s390x-static /usr/bin/
    
    RUN mkdir /install
    WORKDIR /install

    The upper part is a x86-based Dockerfile, and the lower part can be made to support the LinuxONE platform by simply modifying two lines. Where:
    FROM s390x/python:3.7-alpine as base
    The basic images of Python are images supported by different platforms and required for building LinuxONE, and platform support of s390x is necessary. IBM Z on the official website of dockerhub refers to the platform support.

    COPY qemu-s390x-static /usr/bin/
    This sentence is the key to multi-platform support. Through multiarch/qemu, it is possible to directly build LinuxONE container images on x86 across platforms without logging onto the LinuxONE platform.

     

    (2) Execute building script dockerBldRun.s390x.sh.

    Enter ./dockerBldRun.s390x.sh

     

    When building a container image, it is necessary to obtain the latest qemu version first, and then unpack it and run a virtual container with heterogeneous support. 
    Then start to build the LinuxONE container image:
    docker build -f Dockerfile.s390x -t ${cscRepo}/`whoami`multiarch:s390x .

    We can see that it is not much different from building a x86 platform container image, except for the use of Dockerfile.s390x in the first step. (Please note that in order to distinguish the s390x medium from the x86 medium, the s390x tag is used here)
    After the container image is pushed to the warehouse, you can use the image like those on other platforms.

    When you see a piece of information similar to the following one, it means that the docker image corresponding to s390x has been successfully built and incorporated into the library.


    s390x: digest: sha256:6aadffdd5cdee6adeca9936d49f2ea4ca0ebe4928bb891d4e6f0838c6cb431e4 size: 1786

     

    (3) Finally, use the ssh command to access the remote machine (domain name: linuxone), run the image and execute the uname -a command remotely, and then you can see that the remote machine has an s390x architecture.
    Enter ssh zj2c@linuxone "uname -a"
    The following information will be displayed.
    Linux bz0512 3.10.0-957.el7.s390x #1 SMP Thu Oct 4 16:53:20 EDT 2018 s390x s390x s390x GNU/Linux

     

    Run the docker application remotely.
    Enter  ssh zj2c@linuxone "docker run -p ${dockerPort}:5000 --name=`whoami` ${cscRepo}/`whoami`multiarch:s390x"

    The output is described as follows:

    * Serving Flask app "hello" (lazy loading)
    * Environment: production
      WARNING: Do not use the development server in a production environment.
      Use a production WSGI server instead.
    * Debug mode: off
    * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

     

    Open the browser and enter the address: http://linuxone:500x, and then we can see the operation result as shown in the following figure.

    Note 1:   It is being executed on a remote machine, so the IP address should be the domain name of the remote machine, linuxone, instead of 0.0.0.0.

Scan here to share it


Reserve Experiment Summary

Experiment Name:

Experiment Content: Quickly Build Host Container Images on a x86 Platform (LinuxONE or zCX)

:

Hour(s)

Points:,This appointment will use 50 points

You have successfully reserve this experiment. You can view it at Personal Center > My Reservation later

You are not authorized to reserve the experiment!

It’s only for Premium Member.

VIP 项目申请

什么是VIP项目:
可以在一段时期内使用您专有的实验资源,进行深入测试。期间可以根据您的需要手工进行环境的初始化与回收

实验名称:
主机容器镜像异构构建 (LinuxONE 或 zCX)
在x86平台快速构建主机容器镜像 (LinuxONE 或 zCX)

Please login before sharing



    Copy succeeded


Please fill in the email address

    Send succeeded

Poster sharing

Scan to share poster

您将使用100个消费积分开启自由实验

您当前的消费积分不足

您将使用200个消费积分解锁VIP实验

您当前的消费积分不足

您将使用50个消费积分预约实验

您当前的消费积分不足

该天预约已满,请选择其他时间

Non-Premium Member only has 5 opportunities every month to experiment. You still have 0 opportunities. Do you want to start the experiment now?

p.s Premium Member enjoys unlimited access to routine experiments.
沪ICP备18004249号-1