Docker compose user rights

I use docker-compose version 1.8.0
I want auto create in container current user from host, and add user www-data to group
I add in docker compose line user: “1000:1000” but not work

Why so unclear and non transparent work with user rights?
Why default user in container is root?
Why not using current user in container?
Maybe old version?

Your compose version is old. The latest version is 1.25.1…

user: 1000:1000 does change the UID:GID for the first USER declaration in the Dockerfile.
If the Dockerfile used to build the image does not add a restricted user and uses it in the USER declaration, docker-compose won’t be able to apply UID:GID changes. If an image does not provide the required precondition, you will need to create your own…

I need create my dockerfile, inherit from image and write commands about user rights and groups?
then build new image and then create new container with new user?

The setting you used does only apply for the first(!) declared USER directive of an iamge. This is regardless in which base image the user was added and the directive was declared.

Check the image with docker history {image name/id} to see what steps have been used to create the image. You will see if the USER was used or not.

If the USER directive is missing in the history of an, then yes, you would need to write your own dockerfile, add user and group, build the image and run a container based on it to use that feature. Though, you might check for alternative images on dockerhub first.