How to deploy docker image created with version 2 on the aws

1
down vote
favorite
I am new to docker. I did somehow create docker project with version 2 docker compose following is my docker-compose.yml

version: “2”

services:

Configuration for php web server

webserver:
image: inshastri/laravel-adminpanel:latest
restart: always
ports:
- ‘8080:80’
networks:
- web
volumes:
- ./:/var/www/html
- ./apache.conf:/etc/apache2/sites-available/000-default.conf
depends_on:
- db
links:
- db
# - redis
environment:
DB_HOST: db
DB_DATABASE: phpapp
DB_USERNAME: root
DB_PASSWORD: toor

Configuration for mysql db server

db:
image: “mysql:5”
volumes:
- ./mysql:/etc/mysql/conf.d
environment:
MYSQL_ROOT_PASSWORD: toor
MYSQL_DATABASE: phpapp
networks:
- web
restart: always

Configuration for phpmyadmin (optional)

phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_PORT: 3306
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: toor
ports:
- “8004:80”
restart: always
depends_on:
- db
networks:
- web
redis:
image: redis:4.0-alpine

Network connecting the whole app

networks:
web:
driver: bridge
and with docker file as below

FROM ubuntu:16.04

RUN apt-get update
&& apt-get install -qy language-pack-en-base
&& locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8

RUN apt-get -y install apache2
RUN a2enmod headers
RUN a2enmod rewrite

add PPA for PHP 7

RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository -y ppa:ondrej/php

Adding php 7

RUN apt-get update
RUN apt-get install -y php7.1 php7.1-fpm php7.1-cli php7.1-common php7.1-mbstring php7.1-gd php7.1-intl php7.1-xml php7.1-mysql php7.1-mcrypt php7.1-zip
RUN apt-get -y install libapache2-mod-php7.1 php7.1 php7.1-cli php-xdebug php7.1-mbstring sqlite3 php7.1-mysql php-imagick php-memcached php-pear curl imagemagick php7.1-dev php7.1-phpdbg php7.1-gd npm nodejs-legacy php7.1-json php7.1-curl php7.1-sqlite3 php7.1-intl apache2 vim git-core wget libsasl2-dev libssl-dev

RUN apt-get -y install libsslcommon2-dev libcurl4-openssl-dev autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev

RUN apt-get install -y imagemagick graphicsmagick
RUN a2enmod headers
RUN a2enmod rewrite

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
RUN ln -sf /dev/stdout /var/log/apache2/access.log &&
ln -sf /dev/stderr /var/log/apache2/error.log
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR

Update application repository list and install the Redis server.

RUN apt-get update && apt-get install -y redis-server

Allow Composer to be run as root

ENV COMPOSER_ALLOW_SUPERUSER 1

Setup the Composer installer

RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig
&& php -r “if (hash(‘SHA384’, file_get_contents(’/tmp/composer-setup.php’)) !== trim(file_get_contents(’/tmp/composer-setup.sig’))) { unlink(’/tmp/composer-setup.php’); echo ‘Invalid installer’ . PHP_EOL; exit(1); }”
&& php /tmp/composer-setup.php
&& chmod a+x composer.phar
&& mv composer.phar /usr/local/bin/composer

Install composer dependencies

RUN echo pwd: pwd && echo ls: ls

RUN composer install

EXPOSE 80

Expose default port

EXPOSE 6379

VOLUME [ “/var/www/html” ,"./mysql:/etc/mysql/conf.d",]
WORKDIR /var/www/html

ENTRYPOINT [ “/usr/sbin/apache2” ]
CMD ["-D", “FOREGROUND”]

COPY . /var/www/html
COPY ./apache.conf /etc/apache2/sites-available/000-default.conf
Now there are 2 things which i cannot understand after googling a lot 1) when i give the image to my friend he took the pull and when he ran it was without the other services like mysql and phpmyadmin

  1. how should i deploy this application to ec2 amazon

There are lots of things but cannot understand any of them like ec2 beanstalk etc Please guide a simple uploading of my image file to aws and run on it also how can i run my image on my friends pc as i thougth docker was a container managment system it should get all my services as when my friend or any one takes a pull of my image

for refrence my image is inshastri/laravel-adminpanel

Please help thanks in advance