Vous êtes sur la page 1sur 4

Build and Deploy ODM Container with Docker :

Check Current directory:


pwd

Docker
Docker is installed on both servers and each have an image called odm89. Please follow these
commands to reinstall docker and images and for starting and stopping the server. Use the
following instructions to build an ODM image for docker. (image is already built and installed on the
server)

Docker Installation
Follow these commands to install:
[ec2-user@ip-172-31-25-48 /]$ sudo su
[root@ip-172-31-25-48 /]# sudo yum install yum-utils
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Package yum-utils-1.1.31-42.el7.noarch already installed and latest version
Nothing to do
[root@ip-172-31-25-48 /]# sudo yum-config-manager --enable rhui-REGION-rhel-server-extras

sudo yum install docker

Check docker version :


docker -v
Dockerfile contents :

Docker can build images automatically by reading the instructions from a Dockerfile, a text file
that contains all the commands, in order, needed to build a given image. Dockerfiles adhere to
a specific format and use a specific set of instructions.

Reference : Dockerfile Reference .

# ODM 8.9.0.1 on liberty 8.5.5.5 with microsoft database


#
# VERSION 1.0
FROM websphere-liberty:8.5.5
MAINTAINER Ming Li <lmming@cn.ibm.com>
# accept license by default
ENV LICENSE=accept
# Deploy database driver for microsoft
COPY mssql-jdbc-6.2.2.jre8.jar /opt/ibm/wlp/usr/shared/resources/microsoft/
# Init microsoft database
#
# ADD data.tar.gz opt/ibm/wlp/usr/shared/resources/
# Deploy the war files for RES and DC
COPY apps /opt/ibm/wlp/usr/servers/defaultServer/apps/
# Update server configuration
COPY server.xml /opt/ibm/wlp/usr/servers/defaultServer/
COPY jvm.options /opt/ibm/wlp/usr/servers/defaultServer/

Docker file is available on : /home/ec2-user/build_mssql

Start docker service :

sudo service docker start


Build Docker image :
Navigate to the location of Dockerfile In the server in our case
/home/ec2-user/build_mssql

docker build -t odm89 .

Check the list of all docker images present in the server [Optional]:
docker images -a

Run the docker container based on an image :


docker run --restart always -p 80:9080 -p 9443:9443 odm89
List all containers [Optional]:
docker ps –a

Check Container Stats[Optional] :


docker stats

Stop Running Container by Container ID :

docker stop [OPTIONS] CONTAINER [CONTAINER...]

Remove all stopped containers :

$ docker rm $(docker ps -a -q)

For more commands reference :


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