Skip to content

Permissions on /tmp when launching with sbtuser #258

Description

@dcunited001

I've rebuilt the image with build args USER_ID and GROUP_ID and I think I'm getting an error related to #219

I'm launching the container via emacs and then launching SBT via tramp (see: hvesalai/emacs-sbt-mode#170). However, I'm getting the error no matter how I launch the containers. When connect with the root user, it goes away, but then I end up creating extraneous root-owned files in the project.

My current docker compose:

services:
  scala:
    build:
      context: .
      dockerfile: docker-sbt.Dockerfile
      args:
        USER_ID: 1000 #${USER_ID:-1000}
        GROUP_ID: 1000 #${GROUP_ID:-1000}
        #SCALA_VERSION: ${SCALA_VERSION:-2.13.10}
        #SBT_VERSION: ${SBT_VERSION:-1.6.2}
        #BASE_IMAGE_TAG: ${BASE_IMAGE_TAG:-11.0.16.1_1-jdk}
        #FROM eclipse-temurin:${BASE_IMAGE_TAG}
    container_name: courserascala1
    hostname: courserascala1
    image: dc/sbtscala
    user: sbtuser
    working_dir: /home/sbtuser/project
    command: /bin/bash 
    # command: sbt # still happens
    stdin_open: true
    tty: true
    volumes:
      - type: bind
        source: recfun
        target: /home/sbtuser/project

The specific error

java.io.IOException: Permission denied
	at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.base/java.io.File.createTempFile(File.java:2129)
	at sbt.StandardMain$.$anonfun$initialGlobalLogging$1(Main.scala:242)
	at sbt.internal.io.Retry$.apply(Retry.scala:46)
	at sbt.internal.io.Retry$.apply(Retry.scala:28)
	at sbt.internal.io.Retry$.apply(Retry.scala:23)
	at sbt.StandardMain$.createTemp$1(Main.scala:240)
	at sbt.StandardMain$.$anonfun$initialGlobalLogging$3(Main.scala:246)
	at sbt.internal.util.GlobalLogBacking$.apply(GlobalLogging.scala:61)
	at sbt.internal.util.GlobalLogging$.initial(GlobalLogging.scala:88)
	at sbt.StandardMain$.initialGlobalLogging(Main.scala:247)
	at sbt.StandardMain$.initialGlobalLogging(Main.scala:250)
	at sbt.StandardMain$.initialState(Main.scala:280)
	at sbt.xMain$.$anonfun$run$11(Main.scala:126)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withIn(Console.scala:230)
	at sbt.internal.util.Terminal$.withIn(Terminal.scala:578)
	at sbt.internal.util.Terminal$.$anonfun$withStreams$1(Terminal.scala:358)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withOut(Console.scala:167)
	at sbt.internal.util.Terminal$.$anonfun$withOut$2(Terminal.scala:568)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withErr(Console.scala:196)
	at sbt.internal.util.Terminal$.withOut(Terminal.scala:568)
	at sbt.internal.util.Terminal$.withStreams(Terminal.scala:358)
	at sbt.xMain$.withStreams$1(Main.scala:87)
	at sbt.xMain$.run(Main.scala:121)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:57)
	at sbt.xMain.run(Main.scala:46)
	at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
	at xsbt.boot.Launch$.run(Launch.scala:149)
	at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
	at xsbt.boot.Launch$.launch(Launch.scala:159)
	at xsbt.boot.Launch$.apply(Launch.scala:44)
	at xsbt.boot.Launch$.apply(Launch.scala:21)
	at xsbt.boot.Boot$.runImpl(Boot.scala:78)
	at xsbt.boot.Boot$.run(Boot.scala:73)
	at xsbt.boot.Boot$.main(Boot.scala:21)
	at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.io.IOException: Permission denied

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions