https://kotlinlang.org logo
#ktor
Title
# ktor
t

tjohnn

08/29/2019, 4:05 AM
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

Robert Menke

08/29/2019, 11:36 AM
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

tjohnn

08/29/2019, 11:48 AM
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

Robert Menke

08/29/2019, 1:19 PM
Can you post your dockerfile?
t

tjohnn

08/29/2019, 3:34 PM
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

Robert Menke

08/29/2019, 3:50 PM
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

tjohnn

08/29/2019, 6:05 PM
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

Robert Menke

08/29/2019, 6:16 PM
ya that looks fine
t

tjohnn

08/29/2019, 10:21 PM
Okay thanks
2 Views