Run command with sudo in container

Hi, I don’t understand how to run in a right way command inside container under specific user.
First, I made own ubuntu image with all updates and necessary software
Second, I made own Elasticsearch image base on my 1st image(just add ppa and install elastic)
Third, I’ve created docker-compose.yml:

  restart: always
  image: localhost:5000/at-elastic:v3 
    - 9200:9200
    - 9300:9300
  user: elasticsearch
  command: /usr/share/elasticsearch/bin/elasticsearch -Des.pidfile=/var/run/elasticsearch/ -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/opt/logs -Des.default.path.conf=/etc/elasticsearch
    - /opt/docker/dockerfiles/elasticsearch/data/:/opt/data
    - /opt/docker/dockerfiles/elasticsearch/logs/:/opt/logs
    - /opt/docker/dockerfiles/elasticsearch/conf/:/etc/elasticsearch

But when I run it, I don’t get running elastic, but If I run image in interactive mode and run elastic with the same command manually - everything works fine.
BTW, I tried without option user and my command was:

command: bash -c “sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch -Des.pidfile=/var/run/elasticsearch/ -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/opt/logs -Des.default.path.conf=/etc/elasticsearch”

I’m sorry, USER option really works, there was another issue, topic should be closed.