Docker Community Forums

Share and learn in the Docker community.

How to get locally build WAR and MySQL to docker hub?


#1

I finally have one docker container talking to another (my mistakes not understanding all the docker down syntax), but now I’d like to push those two containers up to docker hub.

My docker-compose file is below. How would I modify it so it builds the images locally then pushes them to my docker repo?

Thanks,

version: '3'
services:
   app:
      build:
        context: .
        dockerfile: Dockerfile
      ports:
        - "8089:8080"
      volumes:
        -  /Users/mike/Library/apache-tomcat-9.0.7/conf/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml
      depends_on: 
        - db
    
   db:
      image: mysql:5.7
      container_name: test-mysql-docker
      ports:
           - 3307:3306
      volumes:
       - ./ZipCodeLookup.sql:/docker-entrypoint-initdb.d/ZipCodeLookup.sql
      environment:
           MYSQL_ROOT_PASSWORD: "thepass"

(Martin Terp) #2

Note its the the container, but the image that gets pushed


#3

Yes, I saw that. I was posting here since the example you linked to didn’t actually include the word “push”. (See example at bottom of your linked documentation).

So, given my docker-compose file above, what would the correct syntax be to push the two services?

My “Dockerfile” referenced in the docker-compose is this:

FROM tomcat:8.0.20-jre8

COPY ./services.war /usr/local/tomcat/webapps/

So, would I add a push after the COPY? What would I push?

Thanks,