I am having issues with docker containerized appli...
# ktor
t
I am having issues with docker containerized application, it is not creating sessions and throws
java.util.NoSuchElementException: No session data found for id b8130c2077351466
, it works fine without containerizing it. Also, I am new to docker . Is there something I need to do that I am missing?
r
Are you writing sessions to the file system? If so, you may need to add the correct permissions for the user you’re using to run you container
t
Yes I am using file systems. But I have done
chown
for the
WORKDIR
I am using already, do I need to grant some access to the session directory separately?
r
Can you post your dockerfile?
t
Okay
Copy code
FROM openjdk:8-jre-alpine

ENV APPLICATION_USER ktor
RUN adduser -D -g '' $APPLICATION_USER

RUN mkdir /app
RUN chown -R $APPLICATION_USER /app

USER $APPLICATION_USER

COPY ./build/libs/dekemi-site.jar /app/dekemi-site.jar
WORKDIR /app

CMD ["java", "-server", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-XX:InitialRAMFraction=2", "-XX:MinRAMFraction=2", "-XX:MaxRAMFraction=2", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "dekemi-site.jar"]
r
Have you tried making that directory writable via chmod?
One thing I would do do speed up your feedback loop is actually run your container locally, exec into it
docker exec -it <name-of-your-container> /bin/bash
(find the name of your container via
docker ps
), cd to the parent directory of wherever you’re writing sessions to,
ls -la
to see what the existing permissions are, and if necessary in your dockerfile run
chmod 775 <your-directory>
.
t
Okay thanks I will try this
I think I could write this in docker file right?
RUN mkdir /.sessions
RUN chmod 775 /.sessions
?
Does that make sense?
r
ya that looks fine
t
Okay thanks