跳至內容

The dir permission of AWS batch job hosted on ec2 is 755.

0
  1. Format the nvme storage as xfs in the launch template and then mount it. After that, I changed the directory to 777. in user data section. As follows
- temp_dir=/temp
- mkdir -p ${temp_dir}
- mkfs -t xfs /dev/nvme1n1
- mount /dev/nvme1n1 /temp
- chmod 777 /temp
  1. I set launch template in the AWS batch computing environment.
  2. I created a directory in the docker file, changed it to 777 using chmod, prepared to bind mount the directory using VOLUME, and pushed it to ecr. As follows
RUN mkdir -p /data/Analysis
RUN chmod 777 /data/Analysis
RUN adduser ad
RUN chown ad /data/Analysis
VOLUME ["/data/Analysis"]
  1. Volume and mount were specified in Job definitions of AWS batch. As follows
   "volumes": [
      {
        "host": {
          "sourcePath": "/temp"
        },
        "name": "temp"
      }
    ],
    "mountPoints": [
      {
        "containerPath": "/data/Analysis",
        "readOnly": false,
        "sourceVolume": "temp"
      }

However, inside the batch job, the directory is set to 755. How can I change it to 777?

已提問 2 年前檢視次數 229 次
2 個答案
1

I believe your issue is caused by the following lines in your Dockerfile:

RUN chmod 777 /data/Analysis
RUN chown ad /data/Analysis
VOLUME ["/data/Analysis"]

Can you please remove those lines and see if it resolves your problem?

The first two lines are useless, since the mounted filesystem will override any changes you make to the mount point in your container image. And you do not need a VOLUME declaration in this situation.

AWS
專家
已回答 2 年前
  • Thanks for answering my question. I tried it without those lines at first, but it was set to 755. I used instance store, but since I used ebs instead of instance store, it was set to 777. However, I still don't know why the instance store is set to 755.

0
已接受的答案

Instance store is set to 755 no matter what you do. With EBS, 777 is possible. I still don't know why I can't set the instance store to 777.

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。