-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-compose #308
Comments
github: https://github.com/BretFisher/docker-mastery-for-nodejs Assignment: Compose CLI Basics# Run through simple compose commands
$ cd sample-02
$ docker-compose up
$ ctrl-c (same as docker-compose stop)
$ docker-compose down
$ docker-compose up -d
$ docker-compose ps
$ docker-compose logs
# While app is running detached...
$ docker-compose exec web sh
$ curl localhost
$ exit
# edit Dockerfile, add curl with apk
$ RUN apk add --update curl
$ docker-compose up -d
# curl还是不会安装, 因为已经build过一次, 重新build需指定--build
$ docker-compose up -d --build
# Now try curl again
$ docker-compose exec web sh
$ curl localhost
$ exit
# Cleanup(Inside sample-02 directory)
$ docker-compose down
|
docker 3 types of volumes or mounts for persistent datasee: https://stackoverflow.com/a/47152658/2497876 We basically have 3 types of volumes or mounts for persistent data:
Bind mounts are basically just binding a certain directory or file from the host inside the container ( Named volumes are volumes which you create manually with And then there's volumes in dockerfiles, which are created by the What should I use? What you want to use comes mostly down to either preference or your management. If you want to keep everything in the "docker area" ( Docker recommends the use of volumes over the use of binds, as volumes are created and managed by docker and binds have a lot more potential of failure (also due to layer 8 problems). If you use binds and want to transfer your containers/applications on another host, you have to rebuild your directory-structure, where as volumes are more uniform on every host. |
First glance
v2 vs v3
docker-compose.yml (默认文件名)
node.js
mysql
docker-compose up
--build
to always builddocker-compose down
-v
to delete volumesdocker-compose build/stop
docker-componse build --no-cache
重新执行Dockerfile中的每一行命令The text was updated successfully, but these errors were encountered: