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, 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.

enter image description here

Anybody could help me with this. Thanks in advance.

Upvotes: 0

Views: 194

Answers (3)

Visakh Vijayan
Visakh Vijayan

Reputation: 718

If this helps,

Volumes are the docker way to persist data. You can read it up over here

When running the container just add a -v option and specify your path to store your data.

$ docker run -p "port:port" -it -v "path"

Upvotes: 1

avoinea
avoinea

Reputation: 579

You can also use a volume for data like:

$ docker run -p 8080:8080 -it -v plone-data:/data plone-5.2.0-official-cntr

The next time you'll run a new container it will re-use previous data.

Upvotes: 2

invad0r
invad0r

Reputation: 926

This is expected behavior, because docker run starts a new container, which doesn't have the state from your previous container.

You can use docker start CONTAINER, which will have the state from that CONTAINER's setup https://docs.docker.com/engine/reference/commandline/start/

A more common approach is to use docker-compose.yml and docker-compose up -d, which will, in most cases, reuse previous state. https://docs.docker.com/compose/gettingstarted/

Upvotes: -1

Related Questions