Instead of using existing docker volume, couchdb d

2019-07-28 10:58发布

问题:

In my ubuntu 18.04, installed couch db using this repo. In order to data persistance, i have created docker volume using the command docker volume create --name couchdbvolume.

I used docker run -p 5984:5984 -d couchdb -v couchdbvolume:/opt/couchdb/data --name some-couchdb command to create new docker process. Instead of using existing volume, every time docker creates new volume. So i loss data in every restart.

As per this question , un-named volumes are created if the docker file doesn't have name in volume keyword. I think because of this line the volume doesn't have name. so it creates un-named volume.

Instead of multiple docker volume, I expect, only one docker volume(i have only one couchdb docker image)

回答1:

According to the documentation, options should precede the image name.

$ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]

please try the following: docker run -p 5984:5984 -d -v couchdbvolume:/opt/couchdb/data --name some-couchdb couchdb