factoriotools / factorio-docker

Factorio headless server in a Docker container
https://hub.docker.com/r/factoriotools/factorio/
MIT License
883 stars 218 forks source link

Default files not being created when image runs #298

Open dalanmiller opened 4 years ago

dalanmiller commented 4 years ago

I'm not seeing the default config files being created when I start the image. I'm not seeing any permissions issues so I don't think anything is wrong there.

This is using latest and the following command on Mac OSX

sudo docker run -d \
  --network=host \
  -p 34197:34197/udp \
  -p 27015:27015/tcp \
  -v /opt/factorio:/factorio \
  --name factorio \
  --restart=always  \
  factoriotools/factorio
/opt/factorio $ ls -halt                                                                                                                 
total 8
-rw-r--r--  1 root  845     184B  8 Dec 17:14 start.sh
drwxr-xr-x  3 845   845      96B  8 Dec 17:14 .
drwxr-xr-x  3 root  wheel    96B  8 Dec 17:09 ..
dalanmiller commented 4 years ago

Thought it might be because I didn't have /opt/factorio added here:

Screen Shot 2019-12-08 at 5 33 28 pm

This didn't change anything however.

SuperSandro2000 commented 4 years ago

I did a quick test if it works on Linux and it does correctly. Could your Factorio image be old? Other than that I have no clue if this is a mistake on our end or your end as I have no Mac to test this on. If you find more information about this please share them with us in this issue so that we can add the solution to the readme or fix one of the scripts if necessary.

ArmandAgopian commented 4 years ago

I'm running into something similar on Mac, but when I run the logs I get a permission denied. I already chown-d the folder I am trying to use, but it still doesn't work. Any ideas?

aust commented 4 years ago

The quick start guide is mainly focused around running this on a Linux-based host. Running these commands with sudo is overkill since root privileges aren't needed. I created a .factorio directory in my home directory and modified the quick start script to the following:

mkdir -p ~/.factorio

docker run -d \
    -p 34197:34197/udp \
    -p 27015:27015/tcp \
    -v $HOME/.factorio/:/factorio \
    --name factorio \
    --restart=always \
    factoriotools/factorio

You could replace $HOME with the full path, such as /Users/user/.factorio.

SuperSandro2000 commented 4 years ago

Running these commands with sudo is overkill since root privileges aren't needed.

If you haven't added the current user to the docker group they are needed on Linux and doing it like this is the recommended way in production.

TrueOsiris commented 4 years ago

Just my two cents: Imho, remove the image with docker rmi _imagetag_ and pull it again

Perhaps add the read/write handle, like this: -v '/mnt/user/docker/factorio-1':'/factorio':'rw'

Also, have you tried using another map instead of a submap of /opt ?