Thursday, June 22, 2017

4.Learning docker-compose for WebLogic with examples

Learning docker-compose for WebLogic with examples

The docker-compose is one of the docker integration tool. it works based on yml or yaml file. The yml files are easy to read plain like English text. It is developed alternative to JSON files, both are used to store the key, value pairs and hierarchical structured data. To run docker-compose command in the current directory there should be  docker-compose.yml file must be exist.

Prerequisites for docker-compose

  • well awareness of docker
  • YML syntax
  • docker network

docker-compose build with Example


Dockerfile is used to build the docker image that should be present in the current directory.

Create docker-compose.yml file


Lets create the docker-compose.yml file for WebLogic Domain container which uses 1221-appdeploy image. The AdminServer port exposed as 7001 from the container and on left side host port opened with 7001. The container should run the command/shell script. here we can select startWebLogic.sh as starting shell script to be executed when container launched.

Here the docker Compose syntax is simple human readable. alternative to JSON. meta-data.
wls:
 image: 1221-appdeploy
 ports:
  - "7001:7001"
 command:
  - startWebLogic.sh

Now we are ready for Running the container with docker-compose command which will start the container and keep  it running state.

docker-compose up 

To run the docker container in the background we will use -d option

docker-compose up -d 


docker-compose for WebLogic appdeployment container
We have same number of commands as in docker for docker-compose. And it is more powerful than docker commands. because it can start multiple containers with single command.

How to check the WebLogic log files from docker host?

Docker container logs can be viewed from the docker host machine using the following command
  docker-compose logs --tail="all"

  docker-compose logs -f
   




How to get docker-compose process list?

We can get the list of process that are running on docker deamon.
docker-compose ps
docker-compose ps for WebLogic

How to bring down docker-compose containers?


To stop the container we can use stop option
docker-compose stop

To destroy and dispose you can use down option.
docker-compose down

It will stop and remove the container.

Destroying the container will loss all the changes in the last domain configuration. Better to have host volume shared or have a separate container to have WebLogic domains for backup.

No comments:

Post a Comment

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me wlatechtrainer@gmail.com
QK7QN6U9ZST6