linux on powerにおけるdocker利用方法 · test@container:~$ docker ps container id image...

46
Linux on Power Docker "! #$ Power Systems

Upload: others

Post on 19-May-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

Linux on Power����Docker �����"!� ���������#$�� ��������Power Systems ���������

Page 2: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

� ����•

• W• (H H ) OS

������

Baremetal Server Baremetal Server Baremetal Server

OS Hypervisor OS

Bin/libs Docker Engine

…Apps

OS

Bin/libs

Apps

OS

Bin/libs

Apps

OS

Bin/libs

Apps

Bin/libs

Apps

Bin/libs

Apps

����������• O• S•

� �����• O• S• O

Page 3: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• �*���– �#(���&*5/'�"'(����(� ����-��.��68

• Docker Engine– �*����.��� �97

• Dockerfile– Docker�%���30+,�2;������:4�!��)

• Docker�%��– Docker�*����30��1�5/!��)���$– Dockerfile��30���

�������� (1/2)

Page 4: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• Docker�(� �– Docker Engine)�+*����(� �– Docker�$���3-�;.��

• Docker'#��&– Docker�$�� 9��– ������$�� >��56��

• Docker'���&– Docker�$���=,�74���� B0�– /8�1A����'���&�DockerHub– !%�"�� @?��'���&�<C:2

�������� (2/2)

Page 5: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• Docker�� �������� – �� ��������� �POWER��x86������

Docker����������

Dockerfile

Docker����������

BUILD

Docker���

Docker�� ��

RUN

! Dockerfile��� " Docker������� # Docker�� �����

Page 6: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• �%!"���$���+)�/.��Docker+0��#�– POWER*��$�������

Docker Hub

3����

https://hub.docker.com

,���PowerPC 64 LE���� ��64�� ���(IBM+0�����IBM POWER��64�� ��)

POWER*��%!"��$���30,554251 (2019&2'(-)

Page 7: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• �� ���� &!%,��@��+�#�95���– 7<�ubuntu-)#'-���B8��� &!%,�5�+�#�?>�����

���������������� ��

�� &!%,��3C�$�0/�(���

�� &!%,����95����+�#�A���*.%�� &!%,�2=��+�#�B8��� &!%,�5�+�#�����6:����POWER5�x865��+�#�;����POEWR5��+�#�x86*"0��41�����

Page 8: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

Docker ����/��

Page 9: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• "',+

�������• �&

1. Docker � �����2. Docker�#���(��

1. Docker����2. Docker �����$3. Docker�����������.%

3. Dockerfile�% ������)�1. Dockerfile�% 2. Docker ����% 3. % �� ����)�

4. Node.js������!�5. WebSphere Liberty�,+*-

S824

PowerVM

Ubuntu 16.04

Docker 18.03.1-ce

����� �����

Page 10: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

Docker�������

Page 11: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• ���� ����#�

Docker ������ (1/2)

test@container:~$ sudo apt-get install –y ¥ apt-transport-https ¥ca-certificates ¥curl ¥software-properties-common

test@container:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -OK

test@container:~$ sudo add-apt-repository ¥"deb [arch=ppc64el] https://download.docker.com/linux/ubuntu ¥$(lsb_release -cs) ¥stable”

test@container:~$ sudo apt-get update

• �����!�������������

• docker� �GPG Key���

• �� ���"�

Page 12: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

Docker ������ (2/2)

test@container:~$ sudo apt-get update

test@container:~$ sudo apt-get install docker-ce

test@container:~$ sudo usermod -aG docker $(whoami)

• apt�"�

• docker-ce������

• �� �� �– �!��������������

test@container:~$ docker -vDocker version 18.06.2-ce, build 6d37f41

• ��������

Page 13: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

Docker��������

Page 14: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• Docker�������#�������'����– “docker”������%�� (������

Docker����

test@container:~$ docker -hFlag shorthand -h has been deprecated, please use --help

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:--config string Location of client config files (default "/home/test/.docker")

-D, --debug Enable debug mode-H, --host list Daemon socket(s) to connect to-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")

--tls Use TLS; implied by --tlsverify--tlscacert string Trust certs signed only by this CA (default "/home/test/.docker/ca.pem")--tlscert string Path to TLS certificate file (default "/home/test/.docker/cert.pem")--tlskey string Path to TLS key file (default "/home/test/.docker/key.pem")--tlsverify Use TLS and verify the remote

-v, --version Print version information and quit

* ���������&" ���$��!��)������

Page 15: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

Docker���������

test@container:~$ docker pull ubuntu:16.0416.04: Pulling from library/ubuntu27c5699b8c52: Pull completee836b60d364c: Pull complete67624f96cb7e: Pull complete99a51d89d6a0: Pull completeDigest: sha256:e4a134999bea4abb4a27bc437e6118fdddfb172e1b9d683129b74d254af51675Status: Downloaded newer image for ubuntu:16.04

Pull

DockerHub / Docker� ���

�������� �

pull Docker� ���

test@container:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEubuntu 16.04 d67051c921d7 2 weeks ago 155MB

• Linux on Power ��Ubuntu��� ������– “pull” �����DockeHub������ ��Docker� ������� ������

����� �������

Page 16: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• Ubuntu 16.04 21� ��!����– -(��Docker�����)/����! ������

Docker����������� (1/5)

test@container:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEubuntu 16.04 d67051c921d7 3 weeks ago 155MB

test@container:~$ docker run ubuntu:16.04 /bin/echo "hello"hellotest@container:~$

• �!����*+�,%���!��&"���– echo �&"�����– �!����3����!��0'���$ �&"�����– ��!��&"#��!����4.���

Page 17: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• �-�*� �% �- #��1.����– OS�,��-��A;�63����– Bash��+�1.���=?��– exit ��Bash��+�9D�����- #��C:���

Docker����������� (2/5)

test@container:~$ docker run -i -t node /bin/bashroot@95d23d051873:/# lsbin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr varroot@95d23d051873:/# exit

test@container:~$ docker run -d ubuntu:16.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"d14b57471a7268a887da086b5c992b821c1d86a4a6525b60bd57eed051746cbe

• $���*�-"(!�(-2)��- #��1.– “-d” �$���*�-"�1.����– 1@��� “hello world” �1.���- #��>4���

�&�)- “-i” : B</0�57, “-t” : 8E��'#+�1.

Page 18: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• �������– ����������������� ����

Docker����������� (3/5)

test@container:~$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESd14b57471a72 ubuntu:16.04 "/bin/sh -c 'while t…" 16 seconds ago Up 15 seconds tender_elbakyan

test@container:~$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESd14b57471a72 ubuntu:16.04 "/bin/sh -c 'while t…” 9 minutes ago Up 9 minutes tender_elbakyantest@container:~$ docker stop d14b57471a72d14b57471a72test@container:~$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

• �������

Page 19: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• ��������)"��������*#– “attach” ����*#��”Ctrl+P Ctrl+Q” *#$+– “Ctrl+D” � exit���� bash�'-�����������,(���

Docker����������� (4/5)

test@container:~$ docker run -itd --name ubuntu-test ubuntu:16.04 /bin/bashdbf5b1de6c8517c06ca7eadd13885e07c1486e7b4d269a874a7f04deca0373a9test@container:~$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS”C” NAMESdbf5b1de6c85 ubuntu:16.04 "/bin/bash" 4 hours ago Up 4 hours ubuntu-testtest@container:~$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESdbf5b1de6c85 ubuntu:16.04 "/bin/bash" 4 hours ago Up 4 hours ubuntu-testtest@container:~$ docker attach ubuntu-testroot@dbf5b1de6c85:/#root@dbf5b1de6c85:/# read escape sequencetest@container:~$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESdbf5b1de6c85 ubuntu:16.04 "/bin/bash" 4 hours ago Up 4 hours ubuntu-testtest@container:~$

Ubuntu�������)"�&%

“attach” ����)"���������*#

����� )"����*#$+���

bash�)"����������������!

Page 20: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• Docker Engine�/,���=< (#� ) ���)� '��*�!��?2�– �*�!��D8�-��:C�����A@���– B2�����30��-�����)� '�7;�>9����

Docker����������� (5/5)

test@container:~$ docker run -i -t -v /home/test/work:/work ubuntu:16.04 /bin/bashroot@ae6975ac3483:/work# touch txt_container.txtroot@ae6975ac3483:/work# lstxt_container.txtroot@ae6975ac3483:/work# exittest@container:~$ ls /home/test/worktxt_container.txt

test@container:~$ lscloud-init nodejs-image test-image wlp-test worktest@container:~$ ls /home/test/worktest@container:~$

• work��)� '��*�!������$'&�%��?2�

• �*�!�. 51�"��(�#� + 64���� ��

Page 21: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

Dockerfile����������

Page 22: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• Dockerfile���– ���� “echo Hello World” ������ �����

Dockerfile���

test@container:~$ mkdir –p test-image; cd test-image/test@container:~/test-image$ vim Dockerfiletest@container:~/test-image$ cat DockerfileFROM ubuntu:16.04CMD ["echo", "Hello World"]

������������� ������

“echo Hello World”�����

Page 23: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• “docker build” �Dockerfile� �����'#

Docker�������

test@container:~/test-image$ docker build -t helloworld:latest .Sending build context to Docker daemon 2.048kBStep 1/2 : FROM ppc64le/ubuntu:16.0416.04: Pulling from ppc64le/ubuntuDigest: sha256:2ac2edbfbc8f54992f6d4d4a82c7739831c4eaf7dcfb93101db6603fa5f16748Status: Downloaded newer image for ppc64le/ubuntu:16.04---> d67051c921d7Step 2/2 : CMD ["echo", "Hello World"]---> Running in 79e38c78a72bRemoving intermediate container 79e38c78a72b---> dcb385144ba9Successfully built dcb385144ba9Successfully tagged helloworld:latest

���$ ��

�������,�%�

("������$

�����Dockerfile&*��-'�+)!����

Page 24: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• 2/����'� �31

���������

test@container:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEhelloworld latest 7c8e13ed4433 4 seconds ago 155MBubuntu 16.04 d67051c921d7 3 weeks ago 155MB

0,���&)#�-*�����������

• �'� �5.– �)!$����5.�*�– �%()%"�+����8��&)#�-* �����0,���������)!$���'� �76����� “echo” ��-*��49��

test@container:~/test-image$ docker run helloworld:latestHello World

Page 25: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

Node.js��������

Page 26: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

Node.js� �Web�����������• Node.js�%&��$���#�����$����"���+Web�����,-���

test@container:~$ mkdir -p nodejs-image; cd nodejs-imagetest@container:~/nodejs-image$ vim sample.jstest@container:~/nodejs-image$ cat sample.jsvar sys = require('sys');var http = require('http');var server = http.createServer(

function (request, response) {response.writeHead(200, {'Content-Type': 'text/plain'});response.write('Hello World!!');response.end();

}).listen(8080);sys.log('Server running at http://localhost:8080/');

8080!���Web���������������)'����

• Javascript ��# *(

Page 27: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

Dockerfile���

test@container:~/nodejs-image$ vim Dockerfiletest@container:~/nodejs-image$ cat DockerfileFROM node

RUN mkdir /workCOPY sample.js /work

WORKDIR /workCMD ["node", ”sample.js"]

• Dockerfile�/5

Node.js��%���"������� ���.(

��#��!�0,��$��"43� 1+���"����

�%���2*'Node.js�)&�����-(

Page 28: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

������

test@container:~/nodejs-image$ docker build -t node-test:latest .Sending build context to Docker daemon 3.072kBStep 1/5 : FROM nodelatest: Pulling from library/node3c6e73e1f3f7: Pull completed31cd7008a15: Pull complete8f96c2690a34: Pull complete809222cf915d: Pull complete4ee3c546eacd: Pull completec3065ef7de0d: Pull completecb336a5005d1: Pull complete00a81a6db7fa: Pull completeDigest: sha256:0cc92d0934e9f990755b9b22bd449d665c559587b8f8bc4d0d4db33264f60762

• � �����Dockerfile��������

������

� ���� (1/2)

Page 29: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

Status: Downloaded newer image for node:latest---> fee7111843f8Step 2/5 : RUN mkdir /work---> Running in 83c8d3ba15ffRemoving intermediate container 83c8d3ba15ff---> 22dfdba51cf5Step 3/5 : COPY sample.js /work---> 1896bad0a8e0Step 4/5 : WORKDIR /work---> Running in 638b86812295Removing intermediate container 638b86812295---> 198b57cccfbfStep 5/5 : CMD ["node", ”sample.js"]---> Running in 1f2003771426Removing intermediate container 1f2003771426---> d825752cc645Successfully built d825752cc645Successfully tagged node-test:latest

���� � (2/2)

Dockerfile�������������

Page 30: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

�������• Docker�������

– �������������������������� ����test@container:~/nodejs-image$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEnode-test latest d825752cc645 2 minutes ago 973MBhelloworld latest 7c8e13ed4433 3 hours ago 155MBnode latest fee7111843f8 6 days ago 973MBubuntu 16.04 d67051c921d7 3 weeks ago 155MB

Page 31: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

��������• “run” �$&��0� �&� ��3,test@container:~/nodejs-image$ docker run --name node -d -p 9090:8080 node-test06e11b3fece1f01bae76940a81874ba89f6b9b30206b4d56d43e1438bcb977c5test@container:~/nodejs-image$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES06e11b3fece1 node-test "node sample.js" 3 seconds ago Up 2 seconds 0.0.0.0:9090->8080/tcp node

• !%��������– 3,*�-+�9090#����������

#���.+

• #��.+��� – “-p "���#��:�&� �#��” �#��.+�2/�– ��('��&� ��8080#���"��1��9090#���)�������

Page 32: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

WebSphere Liberty�����

Page 33: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• WebSphere Liberty �!�*)�$– WebSphere Liberty Web Profile�����'&"����-6URL��15

http://www-01.ibm.com/support/docview.wss?uid=ibm10744227

• server.xml�73– /,����%����� �(�#�.8+ �� 90����– :2��� ;��40������

����

test@container:~$ mkdir wlp-test; cd wlp-testtest@container:~/wlp-test$ lsDockerfile server.xml wlp-webProfile8-19.0.0.1.zip

Page 34: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

[��] server.xml����<?xml version="1.0" encoding="UTF-8"?><server description="SampleJava">

<!-- Enable features --><featureManager>

<feature>webProfile-8.0</feature></featureManager>

<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->

<httpEndpoint id="defaultHttpEndpoint"host="*"httpPort="9080"httpsPort="9443" />

<!-- Automatically expand WAR files and EAR files --><applicationManager autoExpand="true"/>

</server>

9080����Web���������� �������

Page 35: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

Dockerfile��� : WebSphere Liberty (1/2)FROM ppc64le/ibmjava:8-jre

RUN apt-get update && apt-get install -y unzip

ENV LIBERTY_VERSION 19.0.0_01COPY wlp-webProfile8-19.0.0.1.zip /RUN unzip -q /wlp-webProfile8-19.0.0.1.zip -d /opt/ibmRUN rm /wlp-webProfile8-19.0.0.1.zipRUN chown -R 1001:0 /opt/ibm/wlpRUN chmod -R g+rw /opt/ibm/wlp

ENV PATH=/opt/ibm/wlp/bin:$PATH

ENV LOG_DIR=/logs ¥WLP_OUTPUT_DIR=/opt/ibm/wlp/output

RUN /opt/ibm/wlp/bin/server create && rm -rf $WLP_OUTPUT_DIR/.classCache /output/workarea

WebSphere Liberty��$���"��6+��OS%*&��� $��;�1:

“ENV” 9840�/(

3-,75� $����$���"��������!��2.'�3-��" �$���"���

#��"98���$���"�3-���"��$���)�������$���"

Page 36: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

Dockerfile��� : WebSphere Liberty (2/2)RUN mkdir /logs ¥

&& mkdir /etc/wlp ¥&& mkdir /lib.index.cache ¥&& mkdir -p /home/default ¥&& mkdir /output ¥&& ln -s $WLP_OUTPUT_DIR/defaultServer /output ¥&& ln -s /opt/ibm/wlp/usr/servers/defaultServer /config ¥&& ln -s /opt/ibm /liberty ¥&& mkdir -p /config/configDropins/defaults

USER 1001USER 0:0

CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]

COPY --chown=1001:0 server.xml /config/RUN installUtility install --acceptLicense defaultServer

�!���.($�-)�*%������&"�������� �����*%

WebSphere Liberty �!��� ��.(���OS"�'#����!��0�,/

Dockerfile+�

Page 37: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

�������� : WebSphere Liberty (2/2)

test@container:~/wlp-test$ docker build -t wlp-test:latest .Sending build context to Docker daemon 197.4MBStep 1/17 : FROM ibmjava:8-jre8-jre: Pulling from library/ibmjavaDigest: sha256:64d225dbf83cb3409deaea1a9a22d11e8f5621e12cd69a51a9f8c70e2f902919Status: Downloaded newer image for ibmjava:8-jre---> fc1284ede883Step 2/17 : RUN apt-get update && apt-get install -y unzip---> Using cache---> ee72af12a9c0~ � ~

Product validation completed successfully.Removing intermediate container 76214da27f6b---> 97ebfb79daf9Successfully built 97ebfb79daf9Successfully tagged wlp-test:latest

• ���Dockerfile�������

Page 38: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• �������� ������– ���� ������!��� “IBM Java”���������� "������

������� : WebSphere Liberty

test@container:~/wlp-test$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEwlp-test latest 97ebfb79daf9 3 minutes ago 850MBhelloworld latest 7c8e13ed4433 6 days ago 155MBnode latest fee7111843f8 13 days ago 973MBibmjava 8-jre fc1284ede883 4 weeks ago 418MBubuntu 16.04 d67051c921d7 4 weeks ago 155MBppc64le/ubuntu 16.04 d67051c921d7 4 weeks ago 155MB

��������

����������������

Page 39: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• /�'D9���5%(��J>�– �5%(��9080/�'�.#'G��9080/�' 7�����B9

��������

test@container:~/wlp-test$ docker run -d -p 9080:9080 --name wlp-test wlp-test:latest8dc2cb5e501febdbdc79170a19fa211bb086766f792649550d36700ba429f3d0

• *2� ����$#– J>8�B9�9080/�'����$#�

WebSphere�&)�4'-�"�?F����

;:EA��0�"�,�#��C=���� ���0�"EA8�WAR)��4�server.xml�I�K���� H@��+3��!15�<6 ��

Page 40: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

��

Page 41: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

[��] Docker ����� (1/4)

�� : https://docs.docker.com/engine/reference/commandline/cli/

• �������������docker run –i –t [� ��] /bin/bash

test@container:~$ docker run -i -t node /bin/bashroot@95d23d051873:/# lsbin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usrvar

���

• �������� ���docker images

test@container:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEnode-test latest 729b16ff7252 25 hours ago 973MBnode latest fee7111843f8 7 days ago 973MB

���

Page 42: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

[��] Docker ����� (2/4)

• �������docker ps

test@container:~$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESbcd8ac82c7a5 node-test "node sample.js" 7 seconds ago Up 7 seconds node

��"

• ��� ����(�������)������ �docker run –d [�����]

test@container:~$ docker run -d –name node node-testbcd8ac82c7a552bfe4f87ccf2a8775373455af22172090dde0c17ad64637c098

��" (--name ������!�)

�� : https://docs.docker.com/engine/reference/commandline/cli/

Page 43: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

[��] Docker ����� (3/4)

• ������docker rm [ ����ID / �����]

test@container:~$ docker rm bcd8ac82c7a5bcd8ac82c7a5

��� (stop ��������������rm ���������)

• ���� �docker stop [ ����ID / �����]

test@container:~$ docker stop bcd8ac82c7a5bcd8ac82c7a5

���

�� : https://docs.docker.com/engine/reference/commandline/cli/

Page 44: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

[��] Docker ����� (4/4)

• ������/%– exec : ����� �)$�����"���docker exec [�����ID / �����&]

test@container:~$ docker exec -it ubuntu-test /bin/bashroot@c747681b8954:/#

"�. (bash�-#����������� exit �����Ctrl+D� ������2*���)

• ������/%– attach : ����1+�!��!/% (Ctrl+P Ctrl+Q�/%'0)docker attach [�����ID / �����&]

test@container:~$ docker run -itd --name ubuntu-test ubuntu:16.04 /bin/bashc747681b8954867ca3d0780a67d0b27ac8656e60b621b5aff7fe7314bee08018test@container:~$ docker attach ubuntu-testroot@c747681b8954:/#

"�.

,( : https://docs.docker.com/engine/reference/commandline/cli/

Page 45: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• Proxy���– Docker�proxy��!�� systemd���#" � �����

[�] Proxy�������

test@container:~$ sudo mkdir /etc/systemd/system/docker.service.dtest@container:~$ vim /etc/systemd/system/docker.service.d/http-proxy.conftest@container:~$ cat /etc/systemd/system/docker.service.d/http-proxy.conf[Service]Environment="HTTP_PROXY=http://192.168.XXX.XXX:8080/" "HTTPS_PROXY=http://192.168.XXX.XXX:8080/" "NO_PROXY=127.0.0.1,localhosttest@container:~$ sudo systemctl daemon-reloadtest@container:~$ sudo systemctl restart docker

test@container:~$ docker info~ �% ~HTTP Proxy: http://192.168.XXX.XXX:8080/HTTPS Proxy: http://192.168.XXX.XXX:8080/~ �% ~

• �����– ��&� proxy���$�������������

Page 46: Linux on PowerにおけるDocker利用方法 · test@container:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d14b57471a72 ubuntu:16.04 "/bin/sh-c 'while t…”

© 2018 IBM Corporation© 2019 IBM Corporation

• �!����.*$�bash�(" ��!�– ����! “-it”��������/-#&�'�����!����("���

[��] Power Systems���������OS �

test@container:~$ docker run -it ubuntu:16.04 /bin/bashroot@2422e7ec83da:/#

test@container:~$ docker run -it ubuntu:16.04 /bin/bashroot@2422e7ec83da:/# uname -aLinux 2422e7ec83da 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:54:12 UTC 2018 ppc64le ppc64le ppc64le GNU/Linux

• .* ���!���%�OS�,+– POWER)�Ubuntu�.* ���������