File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,61 @@ Note:- if the file name is not Dockerfile
362
362
docker build . -f abc -t img8 # abc is the file name which represents the dockerfile contents
363
363
-------------------------------------------------------
364
364
365
+ -------------------Docker compose------------
366
+
367
+ ---Installation
368
+ 389 sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
369
+ 390 sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
370
+ 391 sudo chmod +x /usr/bin/docker-compose
371
+ 392 docker-compose
372
+ 393 docker-compose --version
373
+
374
+ ---example-1
375
+ version: '3.3'
376
+
377
+ services:
378
+ db:
379
+ image: mysql:5.7
380
+ volumes:
381
+ - db_data:/var/lib/mysql
382
+ restart: always
383
+ environment:
384
+ MYSQL_ROOT_PASSWORD: somewordpress
385
+ MYSQL_DATABASE: wordpress
386
+ MYSQL_USER: wordpress
387
+ MYSQL_PASSWORD: wordpress
388
+
389
+ wordpress:
390
+ depends_on:
391
+ - db
392
+ image: wordpress:latest
393
+ ports:
394
+ - "8000:80"
395
+ restart: always
396
+ environment:
397
+ WORDPRESS_DB_HOST: db:3306
398
+ WORDPRESS_DB_USER: wordpress
399
+ WORDPRESS_DB_PASSWORD: wordpress
400
+ WORDPRESS_DB_NAME: wordpress
401
+ volumes:
402
+ db_data: {}
403
+
404
+ ---Example-2
405
+
406
+ version: '3.3'
407
+
408
+ services:
409
+ db:
410
+ image: ramansharma95/mysql
411
+ webapp:
412
+ image: ramansharma95/webapp
413
+ ports:
414
+ - "84:80"
415
+
416
+
417
+ ----command to run the docker compose file
418
+ docker-compose up -d
419
+ docker-compose down
365
420
366
421
367
422
------------------------Assignment-------------------------------------------
You can’t perform that action at this time.
0 commit comments