1616392928
Confused between Dockerfile and docker-compose because they look and sound similar? But they are not. Read this to clear your doubts.
I’ve seen many people get confused between a Dockerfile and a Compose file. This is primarily because both are used to modify a Docker image in a way, though it’s not technically correct.
It is easy to confuse the two terms, but it’s also necessary to understand the difference when making a conversation with a colleague or your (potential) employer.
Dockerfile is what’s used to create a container image, and a Compose file is what’s used to deploy an instance of that image as a container.
Let me go in a bit of detail so that you properly understand the difference between Docker Compose and Dockerfile.
#docker
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
1596691740
The image manifest provides a configuration and a set of layers for a container image.
This is an experimental feature. To enable this feature in the Docker CLI, one can edit the config.json file found in ~/.docker/config.json like :
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "XXXXXXX"
}
},
"HttpHeaders": {
"User-Agent": "Docker-Client/19.03.8 (linux)"
},
"experimental": "enabled",
"debug": true
}
The docker manifest command does not work independently to perform any action. In order to work with the docker manifest or manifest list, we use sub-commands along with it. This manifest sub-command can enable us to interact with the image manifests. Furthermore, it also gives information about the OS and the architecture, that a particular image was built for.
A single manifest comprises of information about an image, it’s size, the layers and digest.
A manifest list is a list of image layers (manifests) that are, created by specifying one or more image names. It can then be used in the same way as an image name in docker pull
and docker run
commands.
After enabling this feature, one would be able to access the following command :
These commands are easy to use. It basically avoids the need for pulling and running and then testing the images locally, from a docker registry.
Next, to inspect an image manifest, follow this syntax,
docker manifest inspect image-name
.
#devops #docker #devops #docker #docker learning #docker-image
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
1596340980
Docker Compose is a tool that allows you to define and orchestrate multi-container Docker applications. It uses a YAML file to configure the application’s containers, networks, and volumes.
Compose can be used for various purposes. Single host application deployments, automated testing, and local development are the most popular use cases for Docker Compose.
This tutorial will walk through the process of installing the latest version of Docker Compose on Debian 9. We’ll also explore the basic Docker Compose concepts and commands.
Ensure that you have met the following prerequisites before continuing with this tutorial:
The Docker Compose installation package is available in the official Debian 9 repositories but it may not always be the latest version. The recommended approach is to install Docker Compose from the Docker’s GitHub repository.
At the time of writing this article, the latest stable version of Docker Compose is version 1.23.1
. Before downloading the Compose binary visit the Compose repository release page on GitHub and check if there is a new version available for download.
/usr/local/bin
directory using the following [curl](https://linuxize.com/post/curl-command-examples/)
command:sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
docker-compose version 1.23.1, build b02f1306
In this section we will show how to use Docker Compose to manage a WordPress stack on your Debian 9 machine.
#docker #debian 9 #docker compose #yaml file #volumes #networks