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 |
How to check the WebLogic log files from docker host?
Docker container logs can be viewed from the docker host machine using the following commanddocker-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.