Skip to content

Commit f8cdde9

Browse files
committed
Documenting workaround for #1095
For now, a workaround is the only path we have for this situation. Hence, this commit documents a way to do it, and with that, this fixes #1095. [skip ci]
1 parent 501efb9 commit f8cdde9

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

README.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and made the source code freely available under the [Apache License 2.0](LICENSE
1111
Docker images for Grid 4 come with a handful of tags to simplify its usage, have a look at them in one of
1212
our [releases](https://github.com/SeleniumHQ/docker-selenium/releases/tag/4.0.0-20211025)
1313

14-
To get notifications of new prereleases, add yourself as a "Releases only" watcher.
14+
To get notifications of new releases, add yourself as a "Releases only" watcher.
1515

1616
Doubts? Questions? Get in touch through the different communication channels available in the **Community** section.
1717

@@ -676,3 +676,43 @@ or
676676

677677
The reason _might_ be that you've set the `START_XVFB` environment variable to "false", but forgot to
678678
actually run Firefox, Chrome or Edge in headless mode.
679+
680+
### Mounting volumes to retrieve downloaded files
681+
682+
A common scenario is mounting a volume to the browser
683+
container in order to retrieve downloaded files. This
684+
works well in Windows and macOS but not without
685+
workarounds in Linux. For more details, check this
686+
well documented [issue](https://github.com/SeleniumHQ/docker-selenium/issues/1095).
687+
688+
For example, while using Linux, you might be starting a
689+
container in the following way:
690+
691+
```bash
692+
docker run -d -p 4444:4444 --shm-size="2g" \
693+
-v /home/ubuntu/files:/home/seluser/files \
694+
selenium/standalone-chrome:4.0.0-20211025
695+
```
696+
697+
That will mount the host `/home/ubuntu/files` directory
698+
to the `/home/seluser/files` inside the container. The
699+
problem happens because the volume will be mounted as
700+
`root`, and therefore the browser cannot write a file to
701+
that directory because it is running under the user
702+
`seluser`. This happens because that is how Docker mounts
703+
volumes in Linux, more details in the [issue](https://github.com/moby/moby/issues/2259).
704+
705+
A workaround for this is to create the directory on the
706+
host and change its permissions before mounting. Depending
707+
on your user permissions, you might need to use `sudo` for
708+
some of these commands:
709+
710+
```bash
711+
mkdir /home/ubuntu/files
712+
chown 1200:1201 /home/ubuntu/files
713+
```
714+
715+
After doing this, you should be able to download files
716+
to the mounted directory. If you have a better workaround,
717+
please send us a pull request!
718+

0 commit comments

Comments
 (0)