Linux users and groups might seem a bit difficult to set up properly at the beginning on Docker and the host system.
This guide will show some best practices how to deal with users, groups and permissions when mounting volumes and adding folders from the host to Docker images.
User from a host is a different one compared to a user within a Docker container. These two users have also different id.
You can get a user id by running the id
command:
See that which process runs as which user:
ps aux
Check the id of specific user, for example, user www-data
:
id www-data # will be "33" in Ubuntu containers/servers
usermod
command modifies a user account.
chown -R 33 application/
Recommended read and video tutorials: