Error while loading shared libraries in CentOS using Docker Compose command

Statement : While running the Docker Compose command on my CentOS, I got this error saying “docker-compose: error while loading shared libraries: failed to map segment from shared object: Operation not permitted”

Solution : You just need to¬†remount the tmp directory with exec permission. Use the following command for the same –

sudo mount /tmp -o remount,exec

Hope this helps to resolve this issue. ūüôā


Dockerize Java RESTful Application

Please follow the below steps to dockerize your java RESTful application –

Prerequisites : Please insure that Docker, java and mvn is installed on your machine.

  1. Create Dockerfile : Go to the root of the application where pom.xml is contained.¬†Below is the content of my Dockerfile –

cd yourProjectFolder -> vi Dockerfile

#Fetch the base Jav8 image

FROM java:8

#Expose the local application port


#Place the jar file to the docker location

ADD /target/lookupService-1.0-SNAPSHOT.jar lookupService-1.0-SNAPSHOT.jar

#Place the config file as a part of application

ADD /src/main/java/com/test/config/

#execute the application

ENTRYPOINT [“java”,”-jar”,”yourService-1.0-SNAPSHOT.jar”]

  1.  Build Docker Image :

docker build -f Dockerfile -t yourservice .

  1. Run the Docker Image :

docker run -p 8088:8088 -tyourservice

Option -p publishes or maps host system port 18080 to container port 8080.

Note* Please don’t forget to change your base uri that is localhost:8088 to network interface created inside the container listen to all available address.

Few important commands of docker to know :

  1. To find the Id of your running container –

docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES

77558fabec6c¬† ¬† ¬† ¬†yourservice¬†¬† ¬† ¬† “java -jar lookupS…” ¬† 38 minutes ago¬† ¬† ¬† Up 38 minutes ¬† ¬† ¬†>8088/tcp ¬† affectionate_brahmagupta

  1. To kill the process inside the docker using container is –

docker container kill 77558fabec6c(Container Id)

Now you can test your RESt call on port using any of the REST client . Hope it helps ūüôā