Question: I have a flask application running on Ec-2 instance. I could access it from the outside environment with `http:ip-address:5000` where IP-address is the public address of my ec-2 instance.

My flask application code:

```
from flask import Flask

app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def my_form_post():
    return "Hello World"

if __name__ == '__main__':
    app.run(host="my-ec2-private-address", port=5000, debug=True)

```

I dockerized the flask application using the following `Dockerfile`:

```
FROM python:2.7
MAINTAINER noob-reaper
COPY . /Mini
WORKDIR /Mini
RUN pip install -r requirements.txt
EXPOSE 5000
CMD python miniRobot.py

```

My build command was :
`docker build -t robot .`
The build was successful. But when I try to run using the following command:
`docker run -p 5000:5000 robot`  

I get the following error---
`port bindings are not yet supported by rootless containers`

How to resolve the above issue? Is there a way to access flask service running in a Docker container in an ec-2 instance from outside?

Answer: 
I suspect the user on your machine using which you're running docker command is a non-root user.

Suppose your current user on ec2-machine is `user1` (You can verify that by running `users` command). Then run this command to add the user1 to `docker group`.

`usermod -aG docker user1` and then try to run your container.

Try this and let me know.

For more info about what is rootless container check [this](https://www.slideshare.net/AkihiroSuda/rootless-containers) out.
Using `sudo` while building docker images and running docker container resolved this issue. `sudo` helps to run non-root containers