Problems going from container to image to EC2

Hello,

I know I’m just missing something about how docker works so forgive the inexperience in the question. I’ve looked around on Google and either my Google-fu is weak or I’m just not understanding something fundamental here. I Docker documentation gives some hints but I’m still missing something that must be obvious.

So here’s my use case. I want to build wordpress sites by running local docker containers on my system, and push the finished product to an EC2 instance. However… when I’ve tried to push to EC2 from a docker-compose.yml configuration the EC2 instance is created, but the work I’ve done locally is not. I do reference and keep my files and database containers stored outside of the containers with the volumes option so I can keep them if I have to remove and re-create containers. So I’ve figured as a result of this approach I need to have the external volumes transferred to EC2 along with it. But I’m not sure what the best approach for this is. I thought perhaps creating an image from the container would work but I can’t figure out how to deploy the image correctly. Local testing of creating an image from my container from docker-compose effort returns an error message:

docker: Error response from daemon: cannot mount volume over existing file, file exists /var/lib/docker/overlay...

I based my initial attempt to deploy to EC2 on this article (which is basic but got the points across:

Can someone hand me a clue-by-four?

version: '2'
services:
  db:
    image: mysql:5.7
    restart: always
    cpu_shares: 100
    mem_limit: 524288000
    volumes:
      - /Users/me/dev/dockerimages/testwp/db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: WeakSauceDoNotUse
    networks:
      - back
  phpmyadmin:
    links:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 8088:80
      - 8443:443
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: WeakSauceDoNotUse
    networks:
      - back
  wordpress:
    links:
      - db
    image: wordpress:latest
    restart: always
    cpu_shares: 100
    mem_limit: 524288000
    volumes:
      - /Users/me/dev/dockerimages/testwp/wp-content:/var/www/html/wp-content
      - /Users/me/dev/dockerimages/testwp/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
    ports:
      - 80:80
      - 443:443
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: WeakSauceDoNotUse
    networks:
      - back
networks:
  back:
volumes:
  db_data: