Git Product home page Git Product logo

explorecalifornia's Introduction

Docker Commands

Start MySql Container (downloads image if not found)

docker run --detach --name ec-mysql -p 6604:3306 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=explorecali -e MYSQL_USER=cali_user -e MYSQL_PASSWORD=cali_pass -d mysql

view all images

docker images

view all containers (running or not)

docker ps -a

Interact with Database (link to ec-mysql container) with mysql client

docker run -it --link ec-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'

Stop ec-mysql container

docker stop ec-mysql

(ReStart) ec-mysql container

docker start ec-mysql

Remove ec-mysql container (must stop it first)

docker rm ec-mysql

Remove image (must stop and remove container first)

docker rmi mysql:latest

Startup with Profile settings

Default profile, H2 database

mvn spring-boot:run

or

java -jar target/explorecali-2.0.0-SNAPSHOT.jar

mysql profile, MySql database (requires running container ec-mysql)

mvn spring-boot:run -Dspring.profiles.active=mysql

or

java -Dspring.profiles.active=mysql -jar target/explorecali-2.0.0-SNAPSHOT.jar

Dockerize Explore California

Build jar, image, set default profile

mvn package -DskipTests docker:build

container with default property set in Dockerfile

docker run --name ec-app-default -p 8080:8080 -d explorecali-default

Build jar, image, set mysql profile

mvn package -DskipTests docker:build -Dec-profile=mysql

Run Docker container with mysql profile

docker run --name ec-app-mysql -p 8181:8080 --link ec-mysql:mysql -d explorecali-mysql

Build jar, image, set docker profile

mvn package -DskipTests docker:build -Dec-profile=docker

Run Docker container with docker profile set in Dockerfile and migration scripts on host

docker run --name ec-app-docker -p 8282:8080 -v ~/db/migration:/var/migration -e server=ec-mysql -e port=3306 -e dbuser=cali_user -e dbpassword=cali_pass --link ec-mysql:mysql -d explorecali-docker

Enter Docker container

docker exec -t -i ec-app /bin/bash

Push image to Docker hub

######Login to Docker hub locally docker login

Upload image

docker tag <image id> <docker hub repository>/explorecali-default:latest

Download image

docker pull <docker hub repository>/explorecali-default

Run Container from docker hub image

docker run --name ec-app-default -p 8080:8080 -d <docker hub repository>/explorecali-default

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.