docker-compose Example File

Here is my docker-compose file redis

version: "3.7"

services:

  redis:
    container_name: redis
    image: redis:latest
    restart: unless-stopped
    ports:
      - "6379:6379"
    #get PASSWORD_REDIS from /etc/environment
    command: redis-server --requirepass ${PASSWORD_REDIS}
    volumes:
      - redis-volume:/data
    networks:
      - redis-public

volumes:
  redis-volume:

networks:
  redis-public:

And here is my /etc/environment

Variable from /etc/environment

Variable from /etc/environment


Run docker-compose File

Try to run docker-compose file

Variable is Not Set. Defaulting To a Blank String

Variable is Not Set. Defaulting To a Blank String

Invalid Because Contains Non-unique Items

Invalid Because Contains Non-unique Items

This error came when I setup variable in /etc/environment. Usually use source /etc/enviroment or . /etc/environment will load new variable, but it’s not working in this case


Solution

The solution was easy, just logout from current session then login again

Invalid Because Contains Non-unique Items

Invalid Because Contains Non-unique Items


Jika kamu merasa tulisan ini bermanfaat & membantu kamu, kamu bisa berdonasi lewat saweria

If you feel this website help you, you can donate at saweria