Skip to content

A playground with a variety of commonly-used tools you could play with immediately

License

Notifications You must be signed in to change notification settings

quick-start-templates/quick-start-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Playground

A playground with a variety of commonly-used tools you could use from time to time. With Docker Playground, you don't need to memorize and type tons of Docker commands just to build an environment to test something.

How to use

$ cd /directory/to/play
$ git clone https://github.com/awesome-playground/docker-playground
$ cd docker-playground

How to use MySQL immediately

  • Start MySQL server in Docker
$ docker-compose up mysql -d

You can also put your MySQL configuration file into mysql/conf and your database initialization script into mysql/init directory.

  • Connect to MySQL

Connect to MySQL server with any one of your favorite clients(host 127.0.0.1), or Docker(host mysql).

$ mysql -h127.0.0.1 -uroot -p

Or

$ docker run --network docker_localhost --rm -it mysql mysql -hmysql -uroot -proot

How to use PostgreSQL immediately

  • Start PostgreSQL server in Docker
$ docker-compose up postgres -d
  • Connect to PostgreSQL
$ docker run --network docker_localhost --rm -it postgres psql -h postgres -U postgres # password: postgres

How to use Redis immediately

  • Start Redis server in Docker
$ docker-compose up redis -d
  • Connect to Redis
$ docker run --network docker_localhost --rm -it redis redis-cli -h redis

How to use Tomcat immediately

Drop your .war file into tomcat/webapps/, where there is a sample.war file for demostration.

  • Start Tomcat server in Docker
$ docker-compose up tomcat -d
  • Connect to Tomcat

Open your browser and navigate to http://127.0.0.1:8080/sample , where sample is the file name of the .war file you dropped into tomcat/webapps/ without extension.

How to use Nginx immediately

Put your nginx.conf file into nginx/conf/ directory and/or your static web pages into nginx/html, then

  • Start Nginx server in Docker
$ docker-compose up nginx -d
  • Connect to Nginx

Open your browser and navigate to http://127.0.0.1 .

How to play with Elasticsearch

  • Start Elasticsearch server in Docker
$ docker-compose up elastic -d

Done!

How to use multple services together

If you want to proxy your Tomcat server with Nginx, modify or create your own nginx.conf that redirect all requests to upstream server tomcat,

# ...
server {
    server_name localhost;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://tomcat:8080$request_uri;
    }
}

and start Nginx and Tomcat together,

$ docker-compose up tomcat nginx -d

and you're done!

Enjoy yourself!!

Contributing

If you found a popular tool that is not included, open an issue, a pull request is also welcome.

About

A playground with a variety of commonly-used tools you could play with immediately

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published