Skip to content

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?

asked a year ago225 views
2 Answers
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
EXPERT
answered a year ago
  • 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
Accepted Answer

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.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.