Tìm hiểu docker-compose cơ bản, biên tập file docker-compose.yml để tạo ra các dịch vụ chạy ứng dụng cụ thể, thực hành tạo ra dịch vụ Apache, MySQL, PHP-FPM, Memcached và cài ứng dụng Joomla trên hệ thống này ✌✌✌
♥ Danh sách Video học Docker:
♥ Danh sách Video học Kubernetes:
☞ Đăng ký kênh:
☞ Facebook Page:
Nguồn: https://ftlinuxcourse.com
Xem thêm bài viết khác: https://ftlinuxcourse.com/lap-trinh-linux
Xem thêm Bài Viết:
- Trải nghiệm mới hay ho với hướng dẫn cài Mac Os trên vmware
- Bật mí cách cài đặt ssl miễn phí lên Let’s Encrypt
- Tuyệt chiêu tạo usb boot kali linux đơn giản dành cho bạn
- Hướng dẫn chi tiết từ A – Z các bước cài đặt Python trên Windows 10
- Bật mí quy trình cài đặt Kali Linux trên Vmware đúng chuẩn và chi tiết
Phần khai báo tạo volume trên linux (windows) hãy cho thêm thiết lập type: bind, cụ thể –>
volumes:
dir-site:
driver_opts:
device: /mycode/sites
type: bind
o: bind
Anh cho em hỏi chút là:
khi tạo
dir-site:
driver_opts:
device: /mycode/sites // cái docker-compose đang ở trong thư mục mycode em thắc mắc chỗ này phải là /sites/
Vì em thấy các volume của các container như là ./db chẳng hạn.
Thanks anh ạ.
sau khi em chạy lệnh: docker run –rm -v /mycode/:/home httpd cp usr/local/apache2/conf/httpd.conf /home/
thì thư mục mycode của e bị ánh xạ bởi thư mục home của container. Vậy làm sao để hủy cái ánh xạ đó ạ? Hiện tại em đang bị dính ánh xạ liên tục: lúc đầu vừa ssh vào docker host thì thư mục mycode em ls ra thì sẽ có các folder như myimage, www, db, 1.yml mà mình trực tiếp tạo, nhưng tầm 1 thời gian sau thư mục này lại bị ánh xạ bởi thư mục home và e ls ra thì còn 2 file là httpd.conf và my.conf.
Vậy làm sao để e ngắt ánh xạ này đi ạ?
Cho em hỏi làm thế nào để mount volume cho container trên linux ạ.
Em làm theo đến bước chạy #docker-compose up thì bị lỗi mount ổ đĩa như này
Creating network "mycode_my-network" with driver "bridge"
Creating c-httpd01 …
Creating php-product … error
Creating c-httpd01 … error
ERROR: for php-product Cannot create container for service my-php: failed to mount local volume: mount /mycode/sites/:/var/lib/docker/volumes/mycode_dir-site/_data: no such device
ERROR: for c-httpd01 Cannot start service my-httpd: error while mounting volume '/var/lib/docker/volumes/mycode_dir-site/_data': failed to mount local volume: mount /mycode/sites/:/var/lib/d
Creating mysql-product … done
ERROR: for my-php Cannot create container for service my-php: failed to mount local volume: mount /mycode/sites/:/var/lib/docker/volumes/mycode_dir-site/_data: no such device
ERROR: for my-httpd Cannot start service my-httpd: error while mounting volume '/var/lib/docker/volumes/mycode_dir-site/_data': failed to mount local volume: mount /mycode/sites/:/var/lib/docker/volumes/mycode_dir-site/_data: no such device
ERROR: Encountered errors while bringing up the project.
cho em hỏi thêm vào cuối file my.cnf dòng code "default-authentication-plugin=mysql_native_password" để làm gì ạ ? Em thêm vào nó báo lỗi . không thêm vào dòng đó thì container mysql chạy bình thường
mình tạo 1 image gồm tất cả các dịch vụ được ko a
Rất tuyệt, cảm ơn anh.
nhanh quá . em theo không kịp
rất cảm ơn anh!
Kiến thức vô cùng bổ ích và rõ ràng. Hy vọng anh có thể ra thêm nhiều video và chia sẽ kinh nghiệm cho mọi người ạ.