So I'm trying to setup a container for a project and I'm receiving an error during building. I'm very new with Docker. Can anyone help me understand this?
Here's the error:
[17181 ms] Start: Run in container: # Copy C:\Users\nathan\.ssh\known_hosts to /home/vscode/.ssh/known_hosts
[17187 ms]
[17187 ms] /bin/sh: 15: cannot create /home/vscode/.ssh/known_hosts: Permission denied
[17187 ms] Exit code 2
[17194 ms] Command in container failed: # Copy C:\Users\nathan\.ssh\known_hosts to /home/vscode/.ssh/known_hosts
(dd iflag=fullblock bs=8192 count=0 2>/dev/null; dd iflag=fullblock bs=968 count=1 2>/dev/null) >/home/vscode/.ssh/known_hosts
[17194 ms] /bin/sh: 15: cannot create /home/vscode/.ssh/known_hosts: Permission denied
And here is the dockerfile as requested:
FROM ruby:2-alpine
ENV RAILS_ENV production
ENV APP_HOME /app
ENV CA_CERTS_PATH /etc/ssl/certs
ENV RAILS_LOG_TO_STDOUT true
ENV RAILS_SERVE_STATIC_FILES true
ENV BUNDLE_APP_CONFIG '.bundle'
EXPOSE 3000
RUN bundle config set path 'vendor/bundle'
RUN bundle config set without 'development test assets'
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
CMD ["bin/puma", "-C", "config/puma.rb"]
RUN gem install bundler -v '~> 2'
RUN apk add --no-cache \
tzdata \
busybox \
ca-certificates \
curl \
imagemagick \
libsodium-dev \
postgresql-dev \
postgresql-client \
nodejs \
rsync
COPY . $APP_HOME
COPY config/database.yml.example config/database.yml
Is this a network permission not allowing me to copy files? I'll supply more info as requested.
CodePudding user response:
I think you are running the Docker build on a specific path that need administrator permissions , to resolve that just copy your project to the Desktop for example and try again :
docker build -t image_name:image_tag path_to_dockerfile
Notes: image_name= app (example) image_tag= 1.0 (example) path_to_dockerfile= your current path where you has your Dockerfile , also you can put "." that mean the current path .