sixeyed / diamol

Code samples for the book "Learn Docker in a Month of Lunches"
https://www.manning.com/books/learn-docker-in-a-month-of-lunches
Creative Commons Attribution Share Alike 4.0 International
496 stars 261 forks source link

CH07 Lab - Test Environment #35

Closed mehul08 closed 3 years ago

mehul08 commented 3 years ago

Exercise Section 7.6 Lab, Pg no. 257-258

Problem Screenshot 2021-04-26 at 12 05 33 PM I start the terminal in the "lab" directory of Ch07 and ran the development compose file with the command docker-compose -f docker-compose-dev.yml up -d and it worked. It stared a new container.

I stopped that container and ran the command mkdir -p /data/postgres (out put was "mkdir: /data/postgres: Read-only file system") and then ran docker-compose -f docker-compose-test.yml up -d but it throws an error. Says that the source path for the bind mount doesn't exist.

No directory called data was created in the lab folder. I manually created the data directory and then postgres directory inside it, it still throws the same error that the source path cannot be found.

I was very confused in this lab. I thought that I had to write a docker-compose file but in the lab directory, there were already docker-compose files for dev and test environments. I tried creating a new docker-compose file by looking at the docker-compose file for the todo-list and added restart functionality and volumes. But it failed.

Thank you.

Docker version Client: Docker Engine - Community Cloud integration: 1.0.12 Version: 20.10.5 API version: 1.41 Go version: go1.13.15 Git commit: 55c4c88 Built: Tue Mar 2 20:13:00 2021 OS/Arch: darwin/amd64 Context: default Experimental: true

Server: Docker Engine - Community Engine: Version: 20.10.5 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: 363e9a8 Built: Tue Mar 2 20:15:47 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.4 GitCommit: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e runc: Version: 1.0.0-rc93 GitCommit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec docker-init: Version: 0.19.0 GitCommit: de40ad0

Code version fatal: not a git repository (or any of the parent directories): .git