docker run --name dbdata postgres echo "Data-only container for postgres" # Create our containers docker run-d --volumes-from dbdata --name db1 postgres # Apply the argument to the first container --volumes-from docker run-d --volumes-from dbdata --name db2 postgres # Apply the argument to the second container with --volumes-from docker exec-i-t db1 bash #Podklyuchaetsya to the first container docker exec-i-t db2 bash #Podklyuchaetsya to the second container apt-get update; apt-get install sudo # Update and install sudo sudo-i -u postgres # Go to the postgresql database createdb my_db #create our database docker exec db1 pg_dump -U postgres -F t my_db > my_db-$(date +%Y-%m-%d).tar.gz # Do a dump of the database in the file