Execute docker django application image on Amazon EC2 Linux instance

Hi,

I am brand new to docker. I create a Django application on my local Windows 10 machine. I created Django app, Dockerfile, requirements.txt file and docker-compose.yml file. On my local machine when I issue command “docker-compose up” it works fine and Django application runs well. Below is the screen shot.

image

I want to execute the Django app image from Amazon EC2 Linux instance. To do that I copied Django app image from my local to EC2 instance. I tried to execute “docker-compose up” command on EC2 instance but it did not work and throw error - " Can’t find a suitable configuration file in this directory or any parent.".

Do I need to copy Dockerfile, requirements.txt file and docker-compose.yml file as well in my EC2 instance and build the image again to run the container on it?

This is my first post in docker forum so please forgive me if I did not follow the posting rules.

Thanks!

I am not really familliar with Amazon EC2 but how did you get your image onto the EC2 server?
The common workflow is as follows:

  1. Create the dockerfile on any host and build an image from it
  2. Push the image to a registry like hub.docker.com
  3. Start a container from your image on the registry on any other host

Also did you copy the docker-compose.yml file to your EC2 server? This file configures which container to start with compose. The error sound like you don’t have this config.