Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with mounting volumes

Featured Replies

Hi.

 

Yesterday I started learning Docker for development purposes. I created simple app with Node.js server and SQLite database on backend and React on frontend.

App is creating db.sqlite file in /data directory which I wanted to mount to access the file. However when I open directory on host side, the file is not there. I've been working on it for the last 4 hours and can't figure out what I'm doing wrong.

 

Here is mu Dockerfile. Right now I'm building React app manually.

 

FROM node:14-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN mkdir ./public ./data
RUN mv ./client/build/* ./public
RUN rm -rf ./client

EXPOSE 5000

CMD ["node", "server.js"]

 

I'm then starting the container with:

docker run --name app -p 5030:5000 -v /mnt/user/appdata/users:/data username/usersapp

 

When container is running and I console into it I can run ls /data and I can see the database file being there but it's not in the /mnt/user/appdata/users

 

Is there something fundamentally wrong I'm doing here?

 

Are you sure it's creating the file in /data and not something like /Data

  • Author
9 minutes ago, Squid said:

Are you sure it's creating the file in /data and not something like /Data


I’m sure it’s being written to /data
53E3B460-62E1-42B1-B979-9CF9CE4A431C.thumb.png.d639b8f3f605ed8fbce6a72e79fcacfd.png

According to your screen shots the ‘data’ folder inside the container  is not relative to the / folder inside the container but in a folder relative to a home folder, but the Docker run command IS mapping it at the host level to be relative to /.    That will be why you are seeing what you describe.

 

  • Author
41 minutes ago, itimpi said:

According to your screen shots the ‘data’ folder inside the container  is not relative to the / folder inside the container but in a folder relative to a home folder, but the Docker run command IS mapping it at the host level to be relative to /.    That will be why you are seeing what you describe.

 

After changing it from :/data to :/app/data it’s working now. I read through all these articles and code examples and I was sure all the mappings were relative to the WORKDIR. 
 

Thanks for help

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.