Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose creates directory instead of file

I'm trying to setup my home server (Ubuntu 18.04 LTS) using some docker containers and docker-compose. While trying to setup the "transmission-rss" I get the following error:

/usr/local/lib/ruby/2.6.0/psych.rb:577:in `initialize': Is a directory @ io_fillbuf - fd:5 /etc/transmission-rss.conf (Errno::EISDIR)

And when I went to check if the transmission-rss.conf file had been created a directory with the same name was created in its place.

I have to run the docker-compose up command using sudo so I don't know if this has anything to do with permissions.

Here is my current docker-compose.yml file:

version: '3'
services:
  portainer:
    container_name: portainer
    image: portainer/portainer
    volumes:
      - '/home/miguel/docker/portainer/data/:/data'
      - '/home/miguel/docker/portainer/socket/:/var/run/docker.sock'
    ports:
      - "9000:9000"
    restart: always
  transmission-rss:
    container_name: transmission-rss
    image: nning2/transmission-rss:latest
    volumes:
      - '/home/miguel/docker/transmission-rss/transmission-rss.conf/:/etc/transmission-rss.conf/'
    restart: unless-stopped

The portainer container starts fine.

Thank you very much, Miguel

like image 206
MAntunes Avatar asked Sep 10 '19 20:09

MAntunes


2 Answers

make sure that files exist in both side (inside host machine and inside container).

if one of them not exist then docker create a directory instead of a file

like image 82
TheEhsanSarshar Avatar answered Sep 22 '22 00:09

TheEhsanSarshar


- '/home/miguel/docker/transmission-rss/transmission-rss.conf/:/etc/transmission-rss.conf/'

Please remove the trailing slashes (there are 2x!) and ensure transmission-rss.conf is a file, and not a dir on your host source.

To be slightly more comprehensive:

  1. Follow this to avoid having to use sudo with docker-compose: https://docs.docker.com/install/linux/linux-postinstall (this is not the cause of your issue, but it is annoying to have to preface every command with sudo, basically just need to add your user to the docker group).
  2. Update docker-compose.yml, remove the trailing slashes from source and target for transmission-rss.conf.
  3. Remove your existing volumes (docker volume ls + docker volume rm volume_name) after backing up your data, if needed.
  4. On your host (the machine you are running the docker-compose commands from), make sure the file exists, and is not a directory
  5. docker-compose down
  6. docker-compose build
  7. docker-compose up
like image 31
mikey Avatar answered Sep 20 '22 00:09

mikey