Minakshi
04/17/2021, 1:48 AMdocker run --rm --name pg-docker -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres
but erroring out while using
prefect server start --use-volume --volume-path $HOME/docker/volumes/postgres:/var/lib/postgresql/data
ERROR: for cli_postgres_1 Cannot create container for service postgres: invalid mode: /var/lib/postgresql/data
ERROR: for postgres Cannot create container for service postgres: invalid mode: /var/lib/postgresql/data
ERROR: Encountered errors while bringing up the project.
docker volume create pgdata
Then spinning up postgres with docker run --rm --name pg-docker -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v pgdata postgres
and then starting prefect server with
prefect server start --use-volume --volume-path pgdata
Got this exception
Named volume "pgdata:/var/lib/postgresql/data:rw" is used in service "postgres" but no declaration was found in the volumes section.
Exception caught; killing services (press ctrl-C to force)
ERROR: Named volume "pgdata:/var/lib/postgresql/data:rw" is used in service "postgres" but no declaration was found in the volumes section.
Traceback (most recent call last):
File "/Users/mkorad/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prefect/cli/server.py", line 324, in start
subprocess.check_call(
File "/Users/mkorad/.pyenv/versions/3.8.5/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker-compose', 'pull']' returned non-zero exit status 1.
Zanie
--use-volume
we will create the volume for you (via docker-compose) and it defaults to '~/.prefect/pg_data'
-- you can provide a custom path to the data using --volume-path
--volume-path
is used in the docker-compose
file to map it into the container https://github.com/PrefectHQ/prefect/blob/e751130efcd1f44bd9eef4d5a58670beeace00aa/src/prefect/cli/docker-compose.yml#L18Minakshi
04/19/2021, 10:09 PM'~/.prefect/pg_data'
wouldn't it be overwritten during server restarts? Also trying it out :)Zanie
Minakshi
04/19/2021, 10:25 PMprefect server start --volume-path=<<s3-path>>
Can I use an external path like s3? Does the above command look right for using a custom volume path?Zanie
Minakshi
04/19/2021, 11:57 PM