Create Your First Hybris Docker Image

Hybris Logo

In this article, I will show how to create a Docker image of the SAP Hybris, how to run it and how to publish it to Docker Hub.

Docker and Hybris

1. Create Image

1.1. Prepare Docker Env

Share a directory between your local machine and Docker host machine (if your are using Docker Toolbox for Windows).

Docker machine create shared folder

For my case I have shared the folder c:/Users.

Copy the Hybris Commerce Suite zipped inside the shared directory.

Hybris commerce suite zip docker shared folder

I’m using the version of Hybris, but you can use any version of Hybris you want.

1.2. Create Dockerfile

Dockerfile is a sample text file that contains a series of command lines to be run in order to create a Docker image.

Inside the shared directory, create a file called Dockerfile and put this script in it.

# Create image from primetoninc/jdk:1.8
FROM primetoninc/jdk:1.8

# Author signature

# Copy inside the Container
COPY /src/

# Navigate to /src directory

# Unzip
RUN unzip

# navigate to the platform directory
WORKDIR /src/hybris/bin/platform/

# Add exec permission to .sh files
RUN find ./ -type f -iname "*.sh" -exec chmod +x {} \;

# Expose http port

# Expose https port

# Expose Debug port

# Run ant clean all (also ant initialize if it's needed)
RUN . ./ && ant clean all

# Run Hybris server
CMD ["./"]

2. Build Image

To build the image, open Docker Quickstart Terminal, navigate to the shared folder and run Docker build command.

# Navigate to the shared folder
cd /c/Users/10053174/hybris-image

# Build the image from Dockerfile
docker build -t mouadelfakir/hybris: .

mouadelfakir is my Docker Hub account ID, hybris is the name of the image and is the image version.

3. Run Image

To run Hybris image in normal mode use this command line.

docker run -it -p 9001:9001 -p 9002:9002 mouadelfakir/hybris:

To run Hybris image in debug mode use this command line.

docker run -it -p 9001:9001 -p 9002:9002 -p 8000:8000 mouadelfakir/hybris: ./ debug

If everything goes well, you should be able to access HAC from your browser.

Open hac of Hybris running inside Docker container

4. Publish Image

1. Go to Docker Hub and create a Docker Hub account.

Docker hub create account
2. List all Docker images, using docker ls command.

docker image ls

REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
mouadelfakir/hybris             ea165872b62a        32 minutes ago      5.6GB

3. Tag your Docker image with a name, using docker tag command.

docker tag ea165872b62a mouadelfakir/hybris:

4. Login to Docker Hub, using your account ID and password.

docker login --username=mouadelfakir

5. Push the image to Docker Hub, using docker push command.

docker push mouadelfakir/hybris:

Change mouadelfakir with your Docker hub account ID, in all previous command lines.

Find the Dockerfile of this example on GitHub.

5. ToDo

Some small improvements still needs to Make :

  • Optimize the Dockerfile to prevent creating lots of layers.
  • Bind hybris/bin/custom folder to an external directory using -v flag.
  • Use an Apache Solr image to run Solr on another container and attach it to our image using Docker link.
  • Use a MySQL image to run MySQL on another container and attach it to our image using Docker link.
  • For security seek add and run the image using a non root user using USER command.


Leave a Reply

2 Comment threads
12 Thread replies
Most reacted comment
Hottest comment thread
4 Comment authors
RockVishalMouad EL Fakircaner Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

newest oldest most voted
Notify of

any installation of ant jdk maven and localproperties setting?


I am new to hybris & docker. Can you help me downloading hybris version which you mentioned as
I have already installed docker on mac and using kitematic to look for containers. the only file missing is and i do not have any clue from where to download and run store front accelerator on my local system.

I am oracle commerce developer (ATG) trying to learn hybris. it would be of great help if you can guide me.



I am trying this for windows 10, and when i am trying to unzip the then it is saying unzip is unrecognized commands
# Unzip
RUN unzip
I have winrar and zip extractor.