In Docker, should I reuse base images if possible?

Clash Royale CLAN TAG#URR8PPP up vote
0
down vote
favorite
I am starting using Docker for my Kubuntu desktop.
As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:
I would like to deploy containers for at least these three:
- Web server (Apache)
- SQL-compatible database (MariaDB/MySQL)
- Java custom SDK (OpenSDK-based)
Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.
But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).
If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.
Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).
Thanks in advance.
Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.
server docker
add a comment |Â
up vote
0
down vote
favorite
I am starting using Docker for my Kubuntu desktop.
As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:
I would like to deploy containers for at least these three:
- Web server (Apache)
- SQL-compatible database (MariaDB/MySQL)
- Java custom SDK (OpenSDK-based)
Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.
But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).
If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.
Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).
Thanks in advance.
Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.
server docker
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am starting using Docker for my Kubuntu desktop.
As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:
I would like to deploy containers for at least these three:
- Web server (Apache)
- SQL-compatible database (MariaDB/MySQL)
- Java custom SDK (OpenSDK-based)
Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.
But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).
If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.
Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).
Thanks in advance.
Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.
server docker
I am starting using Docker for my Kubuntu desktop.
As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:
I would like to deploy containers for at least these three:
- Web server (Apache)
- SQL-compatible database (MariaDB/MySQL)
- Java custom SDK (OpenSDK-based)
Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.
But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).
If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.
Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).
Thanks in advance.
Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.
server docker
asked May 24 at 21:18
Davdriver
430216
430216
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.
This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
â Davdriver
May 24 at 22:31
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.
This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
â Davdriver
May 24 at 22:31
add a comment |Â
up vote
1
down vote
accepted
Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.
This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
â Davdriver
May 24 at 22:31
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.
Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.
answered May 24 at 22:22
xenoid
764313
764313
This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
â Davdriver
May 24 at 22:31
add a comment |Â
This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
â Davdriver
May 24 at 22:31
This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
â Davdriver
May 24 at 22:31
This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
â Davdriver
May 24 at 22:31
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1039992%2fin-docker-should-i-reuse-base-images-if-possible%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password