Skip to content

Wrong directory permissions in final image #154

@tonistiigi

Description

@tonistiigi

Using Dockerfile

FROM node:6.11.2-alpine

RUN addgroup -S app && adduser -S -g app app

# Alternatively use ADD https:// (which will not be cached by Docker builder)
RUN apk --no-cache add curl \
    && echo "Pulling watchdog binary from Github." \
    && curl -sSL https://github.com/openfaas/faas/releases/download/0.6.6b/fwatchdog > /usr/bin/fwatchdog \
    && chmod +x /usr/bin/fwatchdog \
    && apk del curl --no-cache

WORKDIR /root/

# Turn down the verbosity to default level.
ENV NPM_CONFIG_LOGLEVEL warn

RUN mkdir -p /home/app

# Wrapper/boot-strapper
COPY package.json       /home/app

WORKDIR /home/app
RUN npm i

# Function
COPY index.js           /home/app

COPY function/*.json    /home/app/function/
WORKDIR /home/app/function
RUN npm i || :
WORKDIR /home/app/
COPY function           ./function
RUN chown app:app -R /home/app
#RUN chmod 777 /tmp

USER app

ENV cgi_headers="true"

ENV fprocess="node index.js"

HEALTHCHECK --interval=1s CMD [ -e /tmp/.lock ] || exit 1

CMD ["fwatchdog"]

In the permissions for the /tmp dir in final image have 0755 permissions while when the same image is built with docker the perms are 777. Locally in buildkit the permissions seem to be correct but looks like they are not properly recognized by the differ when creating layer tars.

via @alexellis

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions