How to deploy and run weblogic from a container ?

Krishnendu Bhowmick
2 min readJan 28, 2023

--

Here’s a step-by-step process for deploying and running WebLogic from a container using a Dockerfile and custom username and password for WebLogic:

  1. Create a new directory for your Dockerfile and navigate to it in the command line.
  2. Create a new file called “Dockerfile” (without any file extension) in the directory.
  3. Open the Dockerfile in a text editor and add the following lines:
FROM oracle/weblogic:12.2.1.3
COPY config.sh /u01/oracle/
RUN /u01/oracle/config.sh

This will use the official Oracle WebLogic image as the base image, copy a shell script called “config.sh” to the image, and run that script

4. Create a new file called “config.sh” in the same directory as your Dockerfile, and add the following lines:

#!/bin/bash
echo "username=<custom_username>" >> /u01/oracle/user_projects/domains/base_domain/security/boot.properties
echo "password=<custom_password>" >> /u01/oracle/user_projects/domains/base_domain/security/boot.properties

This shell script will add custom username and password in the boot.properties file

5. Build the Docker image using the following command:

docker build -t myweblogic .

This will build the image and tag it as “myweblogic”.

6. Run the Docker container using the following command:

docker run -d -p 7001:7001 myweblogic

This will run the container in detached mode and map port 7001 on the host to port 7001 in the container.

7. Verify that WebLogic is running by accessing the WebLogic console in a web browser at “http://localhost:7001/console". You should see the WebLogic login page, and you can log in using the custom username and password that you specified in the config.sh script.

8. Verify the image by running the command

docker images

This will show the list of images, where you can see the image named myweblogic

Note:

  • Make sure that you have the Docker installed on your machine
  • Replace the <custom_username> and <custom_password> with actual desired values in config.sh file
  • Use the correct path in the config.sh file.
  • If you are running this command on Windows or Mac, replace localhost with the IP address of the Docker host.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Krishnendu Bhowmick
Krishnendu Bhowmick

Written by Krishnendu Bhowmick

Site Reliability Engineering | Devops Practitioner | Open Source Advocate | Cloud Enthusiastic

No responses yet

Write a response