arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to create Docker's container and enter its shell [Basic container for any-usage]
#6
(05-27-2021, 07:02 PM)deanhills Wrote: Thanks VERY much for the tutorial @LightDestory.  So for someone who hasn't worked with Docker before (apologies in advance if the questions are too basic).  I have some questions to ask from an experienced user:

1. Is it possible to dockerize/containerize an existing application?  I.e. can I create docker on a system that already has an application running with Debian, and then somehow move the application into a container?  Or is it better to start the container from scratch with a freshly installed OS?

2. Can one have docker with containers PLUS other applications from the command line, or does one have to install docker from scratch on a fresh installation of an OS and then following that all applications need to be run in separate containers.  

3. How safe and secure is Docker itself?  I get a feeling of it being a panel of sorts where containers are attached and detached.

4. What is the difference between a container and backup?  I get it that a container is a shell of sorts in which the software associated with the application has been captured as well, so when you transport the container the software doesn't need to be reinstalled again.  But for me it has the same feel as a backup plugin of WordPress, except Docker container is possibly more secure.

  1. Docker can be installed anytime, no need to have a freshly installed OS. Regarding your question about the application move... well... it works that way. If someone has an application running on the bare hardware you simply decide to move it inside docker. This transition can be easy or complex because it depends on the applicaiton you are talking about. But Docker can containerize almost anything, you just need to study the "Dockerfile" specification and if you want to set up stacks (MYSQL-NGINX-PHP-WP, for example) you can use "docker-compose" that let's you create everything with just a "docker-compose up" command and a provided docker-compose-yml file!
    On this tutorial I didn't use any dockerfile because it was related to @Mashiro advice to do it from scratch to learn the components behind WP.
  2. Docker is just an applicaition that runs other applicaiton. It is not a OS or other low-level tool. You can have docker and other application and they can co-exists. If you want to create a inter-connection between the application (containerized or host-installed) you can set up a virtual network on which docker can communicate. For example you can have WP and MYSQL on different containers but they can communicate, if WP goes down... your MYSQL is untouched and you only need to re-create WP. 
    On this tutorial I said that the container was not optimal because we were abusing of it. Installing every component of application-stack such as WP on the same container is not a good practice... but create different containers and make them communicate is not a 0-knowledge thing.
  3. Docker is safe, it will not hurt your system anyway. When you start a containers is like running an application on background. If you want to interact with it you need to enter itìs shell or manage it via a WEB PANEL, such as Portainerio. 
    I used the -d parameter because without it that command would "block" your terminal because the container will take the control of it. If you close that terminal the container will shutdown... we don't want it... do with -d we say: "you must stay running on background, when I need you I will perform an attach".
  4. A container is not a backup... it is an application running inside a sandbox.. it means it can't see other than itself. It can't damage your system hosting system. For example on a Debian VPS you can run a CentOS container and you will see a total RPM-based system... centos is likely to unkown it is a container. Generaly you don't copy and paste a container, you use a Dockerfile to create a new instance of that application (container).  

I tried to be more friendly possible, I didn't talk about namespaces, cgroups and so on because it is a more technically concept. @Mashiro, if you can explain it more easily you are welcome.
Thanks to Post4VPS and Bladenodefor VPS 14




person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting