When I run docker-compose build && docker-compose up redis
, with the environment
specified in docker-compose.yaml
and RUN env
in Dockerfile
, the environment variables that I set are not printed.
Why is this not working?
I am using docker-compose
version 1.4.2.
Here are the relevant files:
docker-compose.yaml
with environment
as a list of pairs KEY=value
:
redis:
build: ../storage/redis
ports:
- "6379:6379"
environment:
- FOO='bar'
docker-compose.yaml
with environment
as a dictionary:
redis:
build: ../storage/redis
ports:
- "6379:6379"
environment:
- FOO: 'bar'
Dockerfile
:
FROM redis:2.6
MAINTAINER me@email.com
RUN mkdir -p /var/redis && chown -R redis:redis /var/redis
RUN echo '-------------- env ---------------'
RUN env
COPY redis.conf /usr/local/etc/redis/redis.conf
EXPOSE 6379
ENTRYPOINT ["redis-server", "/usr/local/etc/redis/redis.conf"]
source
share