简体   繁体   中英

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

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

- '/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' (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

Let me know if it is still incorrectly being created as a dir, thank you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM