1594368886
When building a containerized application, developers need a way to boot containers they’re working on to test their code. While there are several ways to do this, Docker Compose is one of the most popular options. It makes it easy to:
The vision is that someone writes a docker-compose.yml
that specifies everything that’s needed in development and commits it to their repo. Then, every developer simply runs docker-compose up
, which boots all the containers they need to test their code.
However, it takes a lot of work to get your docker-compose
setup to peak performance. We’ve seen the best teams booting their development environments in less than a minute and testing each change in seconds.
Given how much time every developer spends testing their code every day, small improvements can add up to a massive impact on developer productivity.
#docker #docker development
1595249460
Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub
In this video lesson you will learn:
#docker #docker hub #docker host #docker engine #docker architecture #api
1594368886
When building a containerized application, developers need a way to boot containers they’re working on to test their code. While there are several ways to do this, Docker Compose is one of the most popular options. It makes it easy to:
The vision is that someone writes a docker-compose.yml
that specifies everything that’s needed in development and commits it to their repo. Then, every developer simply runs docker-compose up
, which boots all the containers they need to test their code.
However, it takes a lot of work to get your docker-compose
setup to peak performance. We’ve seen the best teams booting their development environments in less than a minute and testing each change in seconds.
Given how much time every developer spends testing their code every day, small improvements can add up to a massive impact on developer productivity.
#docker #docker development
1615008840
In my previous blog post, I have explained in detail how you can Install Docker and Docker-compose on Ubuntu
In this guide, I have explained the Top 24 Docker Commands with examples.
Make sure you have sudo or root privileges to the system.
#docker #docker-command #containers #docker-compose #docker-image
1600358785
In this blog, we will learn what is docker-compose and how we can deploy a tomcat application which uses mysql database. We will learn how we can setup a development environment using docker-compose in a single command
Prerequisite:
INTRODUCTION
docker-compose up
to start your applicationdocker-compose down
to clean up all the docker containersLet’s take an example here:
We have a project called user registration which uses mysql for storing the data . In terms of microservices, we can say that we have two services as shown below:
You can clone this git repo and try the below example
Explanation of docker-compose
3. web: This is our service name -> using image, ports and volumes
4. **volumes: **To store the database files
Now we will create main docker-compose
file which will together launch a tomcat, mysql and phpmyadmin container
Tomcat container — To run your application
**Database container **— To store the data
PhpMyAdmin — Access the database through GUI
So we will have three services
docker-compose down
all your data will retain. If you use the volume then all data will get lost if you run the docker-compose down
Also, we are importing sql file so that our database is ready with the sample data. It is good so that each developer will always have the base or the actual data to run their application on the local machine
2. phpmyadmin — which is used to access the database through GUI and it depends on service db
3. web — which is used to access your web application and it also depends on service db
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- /opt/test:/var/lib/mysql
- ./mysql-dump:/docker-entrypoint-initdb.d
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testdb1
MYSQL_USER: testuser
MYSQL_PASSWORD: root
ports:
- 3306:3306
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
ports:
- '8081:80'
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: root
web:
depends_on:
- db
image: tomcat
volumes:
- ./target/LoginWebApp-1.war:/usr/local/tomcat/webapps/LoginWebApp-1.war
ports:
- '8082:8080'
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testdb1
MYSQL_USER: testuser
MYSQL_PASSWORD: root
#docker-compose #docker-image #docker
1596766140
Docker позволяет легко помещать приложения и службы в контейнеры, чтобы их можно было запускать где угодно. Однако при работе с Docker можно легко накопить чрезмерное количество неиспользуемых образов, контейнеров и томов данных, замедляющих работу и потребляющих место на диске.
Docker предоставляет все необходимые инструменты для очистки системы из командной строки. В этом руководстве с полезными советами кратко описываются полезные команды для освобождения места на диске и организации системы посредством удаления неиспользуемых образов, контейнеров и томов Docker.
Использование этого руководства:
Синтаксис замены команды command
$(``command``)
, используемый в командах, доступен во многих популярных оболочках, включая bash, zsh и Windows Powershell.
В Docker имеется команда, очищающая все не связанные с контейнерами ресурсы, в том числе образы, контейнеры, тома и сети:
docker system prune
Чтобы удалить все остановленные контейнеры и неиспользуемые образы (а не только образы, не связанные с контейнерами), добавьте в эту команду флаг -a
:
docker system prune -a
Используйте команду docker images
с флагом -a
, чтобы найти идентификатор удаляемых образов. Эта команда покажет вам все образы, включая промежуточные слои образов. Когда вы определитесь с составом удаляемых образов, вы можете передать их идентификаторы или теги в docker rmi
:
Список:
docker images -a
Удаление:
docker rmi Image Image
Образы Docker состоят из нескольких слоев. Несвязанные образы — это слои, не имеющие связей с каким-либо образами с тегами. У них нет никакого назначения, и они просто занимают место на диске. Их можно найти, добавив флаг фильтра -f
со значением dangling=true
в команду docker images
. Если вы уверены, что хотите удалить их, вы можете использовать команду docker images purge
:
#drupal #docker #docker compose #docker images