Plone on Docker always starts from scratch

I'm trying to develope Plone project with Docker, i have used this official image of Plone 5.2.0 GitHub link:
plone/plone.docker/blob/master/5.2/5.2.0/debian/Dockerfile

The images is built a run perfectly with:
$ docker build -t plone-5.2.0-official-img .
$ docker run -p 8080:8080 -it plone-5.2.0-official-cntr

But the plone restarts each time i run the docker container asking to create the project from skratch.

Anybody could help me with this ?
Thanks in advance.

That always starts a new container. Use docker ps -a to show a list of all containers. Example:

docker ps -a

CONTAINER ID    IMAGE           COMMAND    CREATED    STATUS                   NAMES
5660cf3be26f    ubuntu:16.04    "bash"     13h ago    Exited (0) 17 minutes    fervent_babbage```

To start the container again use:

docker start 5660cf3be26f
# or if you need the interactive prompt:
docker start -i 5660cf3be26f

To stop it, use:

docker stop 5660cf3be26f

You can also give it a name:

docker run -p 8080:8080 -d --name plone001 plone-5.2.0-official-cntr

Then use the name instead of the id for starting and stopping.

docker start plone001
docker stop plone001
# or if you need the interactive prompt:
docker start -i plone001
1 Like

Thank you so much.

@albertosanmartin Please be aware there is more you need to do than understanding the difference between starting/stopping or rebuilding containers. To my surprise the README you see on hub.docker.com https://hub.docker.com/_/plone has no documentation yet on persisting your data in Docker using volumes.

The official Plone documentation however does: https://docs.plone.org/manage/docker/docs/data/index.html . Please check this page.

In short: when you start a container (running process) and create a virtual filesystem from an image (a kind of predefined mini-harddisk with all software already installed), any changes the running software makes to the virtual filesystem will be lost when the container is removed. You can stop and start the container, but as soon as you want to upgrade the container to a newer image, you'r stuck.

The idea is to overlay directories in the virtual filsystem and redirect them to another volume, independent from the container or image, for the official Plone image you need to grab the /data directory, 'data volumes' and 'host directories as a data volume'.

1 Like

Plone Foundation Code of Conduct