P
P
Pavel2018-05-31 11:30:02
linux
Pavel, 2018-05-31 11:30:02

How to work with volume in docker-compose?

There is a yml file:

docker-compose.yml
version: '2'
networks:
  bridge:
    driver: bridge
services:
  web:
    image: "rusbaron/documize:latest"
    container_name: documize
    depends_on:
      - db
    ports:
      - "5001:5001"
    environment:
      - DB_USER=DB_USER
      - DB_PASS=DB_PASS
      - DB_NAME=DB_NAME
      - DB_SERVER=DB_SERVER
    links:
      - db
    networks:
      - bridge
  db:
    image: "mysql:5.7"
    container_name: documize_db
#    command: documize_db --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    volumes:
      - mysql-data:/var/lib/mysql
      - mysql-conf:/ect/mysql/conf.d
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=MYSQL_ROOT_PASSWORD 
      - MYSQL_USER=DB_USER
      - MYSQL_PASSWORD=DB_PASS
      - MYSQL_DATABASE=DB_NAME
    networks:
      - bridge
volumes:
 mysql-data: {}
 mysql-cnf: {}


How can I transfer a folder from the host to mysql-cnf?
I saw options where they threw it right in the line, but for some reason it doesn’t work for me
volumes:
      - mysql-data:/var/lib/mysql
      - /home/rusbaron/Docker/Documize/DB_CNF:/ect/mysql/conf.d

When I go into the bash container, I don't see my /etc/mysql/conf.d file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ISE73, 2018-05-31
@ISE73

In docker-compose, you just declare volumes.
But when the container is launched, it is indicated where to connect them.
How are you running the container?
PS I recommend container.training/intro-selfpaced.yml.html#1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question