简体   繁体   中英

How can I add folders and files to a docker container running on ECS?

Assuming I have the following docker-compose

version: "3.9"

services:
  skyrimserver:
    container_name: skyrimserver
    image: tiltedphoques/st-reborn-server:latest
    ports:
      - "10578:10578/udp"
    volumes:
     - /opt/docker/skyrimserver/config:/home/server/config
     - /opt/docker/skyrimserver/logs:/home/server/logs
     - /opt/docker/skyrimserver/Data:/home/server/Data
    restart: unless-stopped

I would like to have the folders specified under volumes created & filled with some files before running it. It seems like the docker integration creates a EFS file system automatically which is empty. How can I hook into that to add files upon creation?

EDIT: A nice solution would be to have the ability to change the config on-the-fly and reloading within the game, not having to restart the whole server because the new docker file includes new configuration files

docker compose is a tool to define run docker. When you define volumes in yaml file it's similar to run docker with arg --mount

What you need with ECS is a fully functioning image with all sources of files in it, using a Dockerfile like this to build image might work:

FROM tiltedphoques/st-reborn-server

CP /opt/docker/skyrimserver/config /home/server/config
CP /opt/docker/skyrimserver/logs /home/server/logs
CP /opt/docker/skyrimserver/Data /home/server/Data

EXPOSE 10578

Hi hope this would help just pu dot infront of you location:

version: "3.9"

services: skyrimserver:

container_name: skyrimserver
image: tiltedphoques/st-reborn-server:latest
ports:
  - "10578:10578/udp"
volumes:
 - ./opt/docker/skyrimserver/config:/home/server/config
 - ./opt/docker/skyrimserver/logs:/home/server/logs
 - ./opt/docker/skyrimserver/Data:/home/server/Data
restart: unless-stopped

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