All the solutions I know to deploy a Docker to EC2 involves running it inside a wrapping Ubuntu.
I want to deploy my Ubuntu docker to EC2 so it will be a standalone EC2 image running by itself.
Is that feasible?
You can not launch EC2 with docker image, EC2 uses AWS AMI to launch instance.
One to way to launch your docker image directly with fargate, which does not manage any instance but will run your image as a standalone container.
AWS Fargate is a compute engine for Amazon ECS that allows you to run
containers without having to manage servers or clusters. With AWS
Fargate, you no longer have to provision, configure, and scale
clusters of virtual machines to run containers. This removes the need
to choose server types, decide when to scale your clusters, or
optimize cluster packing. AWS Fargate removes the need for you to
interact with or think about servers or clusters.
Related
Can I use a Rancher desktop to run workload images on the local machine on the Kubernetes cluster in containers and also offload workload on AWS EKS (run local images on AWS EKS cluster EC2 instances )? I mean can I manage both usages together using one Rancher desktop app?
The workload can be printing numbers from 1-20 using for loop and I want to offload this workload(by creating its image )to AWS EKS cloud or offload the workload to machine2 and run its image in a container and bring the output back to my machine.
I was thinking about using rancher or minikube to run local Kubernetes but I needed a tool which can also offload the work to AWS EKS and also to another machine. (binary usage) So I decided to do some research I am stuck at this point. Can Rancher Solve my problems?
I want to confirm if I have this right.
So, most people compare containers with virtual machine. Its always an either container or virtual machine case according to internet articles.
As far as I understand, ECS is a container orchestration service that runs tasks(1 or more containers) inside an ec2 instance (which is virtual machine).
So are we essentially running containers inside virtual machines?
Please correct my concepts, if they're incorrect.
Your understanding is correct. Amazon ECS is a highly scalable, fast container management service that makes it easy to run, stop, and manage containers on a cluster. Your containers are launched in a cluster of EC2 instances that you manage.
Alternatively, you can choose AWS Fargate to launch your containers without having to provision or manage EC2 instances. AWS Fargate is the easiest way to launch and run containers on AWS.
For more details, please refer to the hands-on ECS workshop and ECS documentation.
I have an application which consists of 2 docker containers. Both are small and need to interact with each other quite often through rest api.
How can I deploy both of them to a single Virtial Machine in Google Cloud?
Usually, when creating virtual machine, I get to chose a container image to deploy: Deploy a container image to this VM instance.
I can specify one of my images and get it running in the VM. Can I set multiple images?
You can not deploy multiple containers per VM.
Please consider this limitation when deploying containers on VMs:
1.You can only deploy one container for each VM instance. Consider Google Kubernetes Engine if you need to deploy multiple containers per
VM instance.
2.You can only deploy containers from a public repository or from a private repository at Container Registry. Other private repositories
are currently not supported.
3.You can't map a VM instance's ports to the container's ports (Docker's -p option).
4.You can only use Container-Optimized OS images with this deployment method. You can only use this feature through the Google Cloud
Platform Console or the gcloud command-line tool, not the API.
You can use docker-compose to deploy multi-container applications.
To achieve this on Google Cloud, you'll need:
ssh access to VM
docker and docker compose installed on the VM
I deploy a docker container on compute engine.
I want to re-deploy this docker container after I build a new docker image with same image name and tag, like webapp:latest
For now, I re-deploy docker container by restart compute engine instance.
I think it's not correct.
What is the correct way for re-deploying a docker container?
When you deploy Docker images on Google Compute Engine virtual machine instances there is some limitation as you can only deploy one container for each VM instance and you can only use Container-Optimized OS images with this deployment method.
I believe the best workaround is to uncheckbox the container option in your instance details to do not deploy a container to the VM instance by using a container-optimized OS image. This option is useful if you want to deploy a single container on the VM.
Instead, install docker in your VM outside the GCP. Also, Consider Kubernetes Engine if you need to deploy multiple containers per VM instance.
I run Rstudio server mostly from an EC2 instance. However, I´d also like to run it from a cluster at work. They tell me that I can setup docker with rstudio and make it run. Now, I´d also like the Rstudios both on EC2 and work to have the same packages and the same versions available. Any idea how I can do this? Can I have both version point to a dropbox folder? In that case, how can I mount a dropbox folder?
You should setup a docker repository on dockerhub or aws ec2 container service (ecs). ECS is a managed service that allows you to easily deploy docker containers onto a cluster of 1 or more ec2 instances that are running the ecs agent (an aws program that helps that cluster work with the ecs). The Dockerfile should install all packages that you need at build time of the image. I suggest referencing the aws ecs documentation, which includes a walkthrough to get you going very quickly (assuming you have an idea of how docker works): https://aws.amazon.com/documentation/ecs/
You should then always run from that docker image, whether you are running on a local or remote machine. One key advantage of docker is that it keeps your application's environments the same (assuming you use the same build of the image) regardless of the host environment.
I am not sure why would not always run on ECS (we have multiple analysts using RStudio, and ECS lets us provision cpu/memory resources to each one, as well as autoscale as needed). You could install docker on EC2 and manage it that way, but probably easier to just install the ecs agent (or use the ecs optimized ec2 ami which has it preinstalled - the docs above walk through configuring it), and use ECS to launch rstudio services.