We're using CircleCI for a project, with the default docker
execution type. This means that each CI job that gets kicked off starts a new Docker container, and the build runs inside that container.
This CI container has the following files:
docker-compose.yml
sql-setup.sql
This docker-compose.yml
file starts a MySQL image and uses volumes
to copy the SQL script inside so it's ready at startup, like:
mysql:
image: mysql:8.0.18
...
volumes:
- ./sql-setup.sql:/docker-entrypoint-initdb.d/sql-setup.sql
(This works on a local developer machine.)
The Problem is that when running on CI, the docker-compose up
in the 'parent' CI container creates a 'child/sibling' container with:
drwxr-xr-x 2 root root 40 Jul 8 17:26 sql-setup.sql
Note it's a directory!
My debugging suggests this is because ./sql-setup.sql
doesn't exist on the host . (Only on the CI container running on the host .)
My Question: How can I configure my docker-compose.yml
(or my CircleCI config) so that the file from the CI container (which is running docker-compose up
) gets copied properly into the resulting mysql
compose container?
Using machine
executor instead of docker
executor solves this
Ref: https://discuss.circleci.com/t/copying-files-to-docker-compose-container/12837
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.