Using volumes on AWS fargate

7,685
  1. Yes, I opened a support ticket and the AWS representative said that Fargate is really intended as a stateless container solution. I took that to mean it's more of a self-made Lambda rather than a managed Docker solution. The suggestion to add persistent storage was taken under consideration and will be added to the feature request list.

    You can add the storage also at the time of container configuration may be you can use NFS or you can upload data from fargate to s3.

  2. With bind mounts, a file or directory on the host machine is mounted into a container. Bind mount host volumes are supported when using either the EC2 or Fargate launch types. Fargate tasks only support nonpersistent storage volumes, so the host and sourcePath fields are not supported. For more information, see fargate task storage.

  3. Your Amazon ECS service can optionally be configured to use Amazon ECS Service Discovery. Service discovery uses AWS Cloud Map API actions to manage HTTP and DNS namespaces for your Amazon ECS services. To create service discovery you can refer to here.

Share:
7,685

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I'm new to fargate and even dockers. But I have used dockers for a couple of months. Only now, I am using fargate.

    I create a particular docker instance as follows:

    docker run -v localHostFolder/configFile:dockerFolder/configFile -v my-vol:/app --restart always --entrypoint "myEntryScript.sh" myDockerImage
    

    This works well on dockers. What I do here is use a config file from my machine "localHostFolder/configFile" and load it onto the docker instance I create. I want the docker instance to be populated with some config values.

    In addition, I use my-vol:/app to save state data from my docker container so if the container restarts, this data can be used.

    Now, a few questions -

    1. I understand Fargate gives u access to just the container and not the underlying host. If so, how do you accomplish the above?

    2. When I try to create a fargate container, I see an option for volumes, but not sure how it works. In fact I see that the mount-volumes drop down is always empty and don't see an option to create one either. Is this something only an admin can do?

    3. Can we do the above using Fargate at all and if so how? If not using volumes, is there an alternate way to do this?

    4. I also noticed there's something called Service discovery that I think can be used to create a fixed dns record so other aws containers can use the dns host name instead of the IP. Is this possible with Fargate? I see it is doable with ECS, but not tried though.