简体   繁体   中英

Error when mount a volume using docker-compose

I'm using docker-compose to setup domserver.I can run the domserver successfully using image of dockerhub.However,when I want to mount a directory into the container,it will pop error message like this:

dj-domserver_1  | /scripts/start.sh: line 29: cd: /opt/domjudge/domserver: No such file or directory

https://i.stack.imgur.com/NVnWW.png

the directory domjudgeKChen is cp from the container that is setup by the image of dockerhub (domserver6.0.3) this is the domserver part in yml file:

dj-domserver:
                image: domjudge/domserver:6.0.3
                volumes:
                        - /sys/fs/cgroup:/sys/fs/cgroup:ro
                        - ~/domjudgeKChen/opt/domjudge:/opt/domjudge
                environment:
                        - CONTAINER_TIMEZONE=Asia/Taipei
                        - MYSQL_ROOT_PASSWORD=rootpw
                        - MYSQL_DATABASE=domjudge
                        - MYSQL_USER=domjudge
                        - MYSQL_PASSWORD=djpw
                networks:
                        dj-db:
                        dj-judgedaemons:
                depends_on:
                  - phpmyadmin
                  - dj-mariadb
                ports:
                        - 9090:80
                links:
                        - dj-mariadb:mariadb
                restart: always

and this is the entire.yml file code:

http://codepad.org/7jN5UdG8

The other question is that I can't setup the judgehost using this yml file.This is the error message when using docker-compose up

error: Authentication failed (error 401) while contacting http://domserver/api/v4/judgehosts. Check credentials in restapi.secret.

https://i.stack.imgur.com/xSEjm.png

If I comment out line 22 in the yml and the domserver can setup using docker-compose up and the mariadb,phpmyadmin would also be fine.

please help me mount the directory into the container and setup the judgehost image successfully.Thanks!

IIRC you must use absolute references for your volumes; you can't use ~ .

Replace ~ in the volume mount with the absolute path and prefix that to /domjudgeKChen/opt/domjudge in your volume definition.

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