Skip to end of banner
Go to start of banner

Set or change the value of environment variable in docker

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

  1. Enter the following command into the vagrant console: docker ps (if you do not have administrator privileges, use sudo before this command and subsequent commands). You should see the following:
  2. Find the image for which you want to set or change the value of the environment variable.
  3. Enter the following command to stop the image in the docker: docker stop 3175fa203456 where 3175fa203456 – docker container id (see in the left column when called docker ps command).
  4. Run image and set a new or changed value using the command: docker run -d -t -i -e enviromentVariableName='value' DockerImage where DockerImage - value from IMAGE column when called docker ps command.
  5. If everything is ok you will see new container id.

Examples:

Use the following command to set environment variables for the database and enable debug mode:

docker run -d -t -i -e DB_USERNAME='folio_admin' -e DB_PORT='5432' -e DB_HOST='10.0.2.15' -e DB_DATABASE='okapi_modules' -e DB_PASSWORD='******' -e JAVA_DEBUG='true' -p 9173:8081 -p 5005:5005 folioci/edge-oai-pmh

where, JAVA_DEBUG='true' – enable debug mode on 5005 port (-p 5005:5005)

           -p 9173:8081  – docker image port number (see in PORTS column when called docker ps command)

           folioci/edge-oai-pmh - docker image (see in IMAGE column when called docker ps command)

If you need to connect to a remote database, then set the value of the remote host as in this command:

docker run -d -t -i -e DB_USERNAME='folio_admin' -e DB_PORT='5432' -e DB_HOST='epuakhaw0025.kyiv.epam.com' -e DB_DATABASE='okapi_modules' -e DB_PASSWORD='*******' -e JAVA_DEBUG='true' -p 9153:8081 -p 5005:5005 folioci/edge-oai-pmh

where, epuakhaw0025.kyiv.epam.com - full address of the remote host (before executing this command, check ping with the remote host).

  • No labels