0

I would like install nodejs, npm, redis and memcached with docker and docker-compose. But i did not install only redis (by document).

I did next: 1 install docker, docker-compose 2 create folder: ~/app 3 in catalog was create Dockerfile, docker-compose.yml, app.py,requirements.txt

requirements.txt:

redis

app.py:

from flask import Flask
from redis import Redis

app = Flask(__name__)
redis = Redis(host='redis', port=6379)

@app.route('/')
def hello():
count = redis.incr('hits')
return 'Hello World! I have been seen {} times.\n'.format(count)

if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)

Dockerfile:

FROM redis:3.2-stable
ADD . /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD [ "app.py"]

docker-compose.yml

version: '2'
services:
  web:
    build: .
    ports:
     - "5000:5000"
    volumes:
     - .:/code
  redis:
    image: "redis:alpine"

run compose docker-compose up -d and have error

Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

What is problem? How setup at least one redis ?

P.S. If you know how install with docker-compose nodejs npm and memcached I will be grateful

2
  • What is your OS? Commented Apr 19, 2017 at 7:31
  • @Confidence Ubuntu 14, core - lts Commented Apr 19, 2017 at 7:58

2 Answers 2

0

Mybe it not good solution, but don't found another. I found on github ready-made solution.

  1. Install docker and docker-compose (docs.docker.com/compose/install/)
  2. Create folder (my project in /var/www/example.com)
  3. Run docker-compose build.
  4. Run docker-compose up
Sign up to request clarification or add additional context in comments.

Comments

0

How about add sudo before your command?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.