Coder Social home page Coder Social logo

play-around-docker's Introduction

After I went though this tutorial

how to setup an app with redis with docker-compose

https://docs.docker.com/compose/gettingstarted/#step-3-define-services-in-a-compose-file

  1. go through the tutorial on the above link
  2. run docker-compose up That's it.

NOTE:

  1. docker-compose automatically links the redis with the app services accessing port '6379', which is the default exposed port of redis.
  2. the redis container created through this process can NOT be accessed by other containers outside of services defined in docker-compose. (docker: Error response from daemon: Cannot link to /playarounddocker_redis_1, as it does not belong to the default network)

how to setup an app with redis without docker-compose

https://docs.docker.com/get-started/part2/#build-the-app (start point is app.py)

  1. cd app
  2. run docker build -t docker-init ., which build an image based on Dockerfile, and Dockerfile uses app.py as an entry point
  3. run docker pull redis to get redis image
  4. run docker run --name redis -p 6379:6379 redis to create a container of reids. DO NOT forget to config the port!!!
  5. run docker run --name hello-redis-3 --link redis -p 4040:80 docker-init, create a container of our app and link it to redis (NOTE: you have to link the redis container here. Different containers may expose same port number, so define the redis port in app.py isn't sufficient)
  6. open link http://localhost:4040/ in browser

how to remove all containers / images

Delete all containers

docker rm $(docker ps -a -q)

Delete all images

docker rmi $(docker images -q)

play-around-docker's People

Contributors

yhan-godaddy avatar

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.