ExFat USB-mount not updated in Docker container
I want to let a docker container access data from a mounted USB external hard drive (ExFat). I mounted the hard drive to an existing and empty /tmp/driveTest folder.
Next, I mounted the tmp folder into the docker-container by entering - '/tmp:/mnt/fs' in my docker-compose.yml file. When the Docker container starts, it successfully reads the data from the hard drive. But when I unmount the drive, without restarting the Docker container, the docker container still sees the folder/file structure while it should not.
When I start the Docker container and mount the drive then, it does not see the folder/file structure at all while it should.
I have tried the options with the privileged: true flag, but that does not seem to have any effect. I also unsuccessfully tried a different mount option:
- type: bind
source: /tmp
target: /mnt/fs
If it is possible what I want to achieve, then how?
linux usb mount docker
add a comment |
I want to let a docker container access data from a mounted USB external hard drive (ExFat). I mounted the hard drive to an existing and empty /tmp/driveTest folder.
Next, I mounted the tmp folder into the docker-container by entering - '/tmp:/mnt/fs' in my docker-compose.yml file. When the Docker container starts, it successfully reads the data from the hard drive. But when I unmount the drive, without restarting the Docker container, the docker container still sees the folder/file structure while it should not.
When I start the Docker container and mount the drive then, it does not see the folder/file structure at all while it should.
I have tried the options with the privileged: true flag, but that does not seem to have any effect. I also unsuccessfully tried a different mount option:
- type: bind
source: /tmp
target: /mnt/fs
If it is possible what I want to achieve, then how?
linux usb mount docker
add a comment |
I want to let a docker container access data from a mounted USB external hard drive (ExFat). I mounted the hard drive to an existing and empty /tmp/driveTest folder.
Next, I mounted the tmp folder into the docker-container by entering - '/tmp:/mnt/fs' in my docker-compose.yml file. When the Docker container starts, it successfully reads the data from the hard drive. But when I unmount the drive, without restarting the Docker container, the docker container still sees the folder/file structure while it should not.
When I start the Docker container and mount the drive then, it does not see the folder/file structure at all while it should.
I have tried the options with the privileged: true flag, but that does not seem to have any effect. I also unsuccessfully tried a different mount option:
- type: bind
source: /tmp
target: /mnt/fs
If it is possible what I want to achieve, then how?
linux usb mount docker
I want to let a docker container access data from a mounted USB external hard drive (ExFat). I mounted the hard drive to an existing and empty /tmp/driveTest folder.
Next, I mounted the tmp folder into the docker-container by entering - '/tmp:/mnt/fs' in my docker-compose.yml file. When the Docker container starts, it successfully reads the data from the hard drive. But when I unmount the drive, without restarting the Docker container, the docker container still sees the folder/file structure while it should not.
When I start the Docker container and mount the drive then, it does not see the folder/file structure at all while it should.
I have tried the options with the privileged: true flag, but that does not seem to have any effect. I also unsuccessfully tried a different mount option:
- type: bind
source: /tmp
target: /mnt/fs
If it is possible what I want to achieve, then how?
linux usb mount docker
linux usb mount docker
asked Jan 15 at 10:39
Waxyen FlaxWaxyen Flax
164
164
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have found the solution, after a lot of trial-error.
In the docker-compose.yml file, I have created a named volume like this:
volumes:
usb-drive:
driver: local
driver_opts:
type: none
o: bind
device: /home/user/usb-mount/
Then, for the container service settings:
volumes:
- usb-drive:/mnt/usb
This volume gets updated when you perform mount and umount actions to the /home/user/usb-mount/ folder.
EDIT: Just make sure you mount the USB-drive(s) after the volume has been created. The path of the mount point is different than /home/user/usb-mount/ after the volume has been created by docker-compose.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394457%2fexfat-usb-mount-not-updated-in-docker-container%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have found the solution, after a lot of trial-error.
In the docker-compose.yml file, I have created a named volume like this:
volumes:
usb-drive:
driver: local
driver_opts:
type: none
o: bind
device: /home/user/usb-mount/
Then, for the container service settings:
volumes:
- usb-drive:/mnt/usb
This volume gets updated when you perform mount and umount actions to the /home/user/usb-mount/ folder.
EDIT: Just make sure you mount the USB-drive(s) after the volume has been created. The path of the mount point is different than /home/user/usb-mount/ after the volume has been created by docker-compose.
add a comment |
I have found the solution, after a lot of trial-error.
In the docker-compose.yml file, I have created a named volume like this:
volumes:
usb-drive:
driver: local
driver_opts:
type: none
o: bind
device: /home/user/usb-mount/
Then, for the container service settings:
volumes:
- usb-drive:/mnt/usb
This volume gets updated when you perform mount and umount actions to the /home/user/usb-mount/ folder.
EDIT: Just make sure you mount the USB-drive(s) after the volume has been created. The path of the mount point is different than /home/user/usb-mount/ after the volume has been created by docker-compose.
add a comment |
I have found the solution, after a lot of trial-error.
In the docker-compose.yml file, I have created a named volume like this:
volumes:
usb-drive:
driver: local
driver_opts:
type: none
o: bind
device: /home/user/usb-mount/
Then, for the container service settings:
volumes:
- usb-drive:/mnt/usb
This volume gets updated when you perform mount and umount actions to the /home/user/usb-mount/ folder.
EDIT: Just make sure you mount the USB-drive(s) after the volume has been created. The path of the mount point is different than /home/user/usb-mount/ after the volume has been created by docker-compose.
I have found the solution, after a lot of trial-error.
In the docker-compose.yml file, I have created a named volume like this:
volumes:
usb-drive:
driver: local
driver_opts:
type: none
o: bind
device: /home/user/usb-mount/
Then, for the container service settings:
volumes:
- usb-drive:/mnt/usb
This volume gets updated when you perform mount and umount actions to the /home/user/usb-mount/ folder.
EDIT: Just make sure you mount the USB-drive(s) after the volume has been created. The path of the mount point is different than /home/user/usb-mount/ after the volume has been created by docker-compose.
edited Feb 6 at 9:39
answered Jan 31 at 8:32
Waxyen FlaxWaxyen Flax
164
164
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394457%2fexfat-usb-mount-not-updated-in-docker-container%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown