FROM openjdk:8u242 RUN useradd -r monte USER monte COPY cassandra-table-cleanup.jar /var/lib/cassandra-table-cleanup/lib/ WORKDIR /var/lib/cassandra-table-cleanup/log/ CMD ["/usr/bin/java", "-jar", "/var/lib/cassandra-table-cleanup/lib/cassandra-table-cleanup.jar"]
chown
chown 不指定 group 时,不会修改 group 为 user 对应的 group !
chown 不使用递归选项 -R 时,子目录及其中的文件属主不会被改变。
1 2 3 4 5 6 7 8 9
FROM openjdk:8u242
COPY cassandra-table-cleanup.jar /var/lib/cassandra-table-cleanup/lib/ RUNmkdir -p /var/lib/cassandra-table-cleanup/log/ && \ groupadd -r monte && useradd -r -g monte monte && \ chown -R monte:monte /var/lib/cassandra-table-cleanup WORKDIR /var/lib/cassandra-table-cleanup/log/ USER monte CMD ["/usr/bin/java", "-jar", "/var/lib/cassandra-table-cleanup/lib/cassandra-table-cleanup.jar"]