Skip to content

Error when restarting docker container with profiles active #473

@diogopruch

Description

@diogopruch

Description:

For the first image build and and container run with the the environment variable PROFILE_NAME=control-plane or PROFILE_NAME=gateway-worker it works ok. However when the container is restarted, an error occurs because the script sh ${WSO2_SERVER_HOME}/bin/profileSetup.sh -Dprofile=${PROFILE_NAME} is executed again.

I solved this problem, removing the lines from docker-entrypoint.sh files:

# optimize WSO2 Carbon Server, if the profile name is defined as an environment variable
if [[ ! -z "${PROFILE_NAME}" ]]
then
  echo "Optimizing WSO2 Carbon Server" >&2
  sh ${WSO2_SERVER_HOME}/bin/profileSetup.sh -Dprofile=${PROFILE_NAME}
fi

Adding the lines to the Dockerfile files:

# optimize WSO2 Carbon Server, if the profile name is defined as an environment variable
ARG PROFILE_NAME
ENV PROFILE_NAME=${PROFILE_NAME}
RUN if [ ! -z "$PROFILE_NAME" ] ; then sh ${WSO2_SERVER_HOME}/bin/profileSetup.sh -Dprofile=${PROFILE_NAME} ; fi

And executing the build with arguments instead of ENV variable:

docker build --build-arg PROFILE_NAME=control-plane

Suggested Labels:

Suggested Assignees:

Affected Product Version:

Docker container wso2am-4.1.0

Steps to reproduce:

Restart a docker container with ENV variable PROFILE_NAME=control-plane or PROFILE_NAME=gateway-worker

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions