<ol>
<li><p>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.</p>
<p>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.</p>
</li>
<li><p>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 <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html" rel="noreferrer">fargate task storage</a>.</p>
</li>
<li><p>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 <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-discovery.html" rel="noreferrer">here</a>.</p>
</li>
</ol>

CC BY-SA 4.0
2019-02-07T04:01:44.013Z
2020-07-08T21:00:07.690Z
2020-07-08T21:00:07.690Z
Harsh Manvar
<p>I'm new to fargate and even dockers. But I have used dockers for a couple of months. Only now, I am using fargate.</p>
<p>I create a particular docker instance as follows:</p>
<pre><code>docker run -v localHostFolder/configFile:dockerFolder/configFile -v my-vol:/app --restart always --entrypoint &quot;myEntryScript.sh&quot; myDockerImage
</code></pre>
<p>This works well on dockers. What I do here is use a config file from my machine &quot;localHostFolder/configFile&quot; and load it onto the docker instance I create. I want the docker instance to be populated with some config values.</p>
<p>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.</p>
<p>Now, a few questions -</p>
<ol>
<li><p>I understand Fargate gives u access to just the container and not the underlying host. If so, how do you accomplish the above?</p>
</li>
<li><p>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?</p>
</li>
<li><p>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?</p>
</li>
<li><p>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.</p>
</li>
</ol>

<docker><amazon-web-services><amazon-ecs>
Using volumes on AWS fargate
Omi
# Using volumes on AWS fargate

(Asked by: username_0 on 2019-02-05)

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 -

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

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?

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?

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.

**Tags:** docker, amazon-web-services, amazon-ecs


---

## 1 answers

### Answer by username_1 on 2019-02-07. Score: 8

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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html).
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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-discovery.html).


---

