Score:2

Unable to change permissions inside AWS Docker ubuntu instance

es flag

I'm trying to run a discord bot in an AWS ubuntu docker container.

My Dockerfile looks like this:

FROM ubuntu 
ADD hydrabot.exe /
ADD bot_config.json /
ADD client_secrets.json /
ADD Cyberbit.ttf /
ADD credentials.txt /
ADD performance.png /
CMD ["./hydrabot.exe"]

I've run;

cd /dockerfiledirectory
sudo chown 1001:1001 /dockerfiledirectory
docker build -t arbitraryname .

And now I'm trying to run: docker run -–restart=always arbitraryname

But I get the error;

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "./hydrabot.exe": permission denied: unknown.

I've read a few stack topics and it indicates trying to set the local aws directory permissions to execute as they are currently; -rw-rw-r-- 1 ubuntu ubuntu 45612135 Jan 27 12:25 hydrabot.exe

I tried both chmod -x hydrabot.exe and sudo -x hydrabot.exe but neither change the permissions when I reinspect.

Artur Meinild avatar
vn flag
Are you trying to execute a Windows executable (.exe) in a Ubuntu container? Just trying to understand here..
L23P avatar
es flag
Yes, pretty much @ArturMeinild. The discord bot was running and breaking inside the native aws instance, someone suggested trying to run it in a docker container.
lnee avatar
td flag
Docker does not emulate the kernel meing that windows exes can not run on Linux but you can run it in a Windows vm with xen or qemu
NotTheDr01ds avatar
vn flag
@lnee Agreed, but even then not in an AWS Ubuntu instance/container (which seems to be what the OP is trying) of any sort unless it supports nested virtualization, which (AFAIK) only bare-metal Ubuntu instances in AWS can handle.
lnee avatar
td flag
but i thought aws used xen
Score:3
vn flag

From the comments, combined with your question, you are attempting to run:

  • a Windows executable
  • ... inside an Ubuntu Docker image
  • ... inside an Ubuntu AWS EC2 instance.

This just isn't going to work. For starters, to run a Windows executable in Docker, regardless, you have to be using a Windows Docker image. You are attempting to use the Ubuntu image.

But even if you were to try to use something like the microsoft/windowsservercore image as a base, that wouldn't work on an Ubuntu EC2 instance. Docker is a containerization technology that requires that the base operating system be able to run the applications, since the kernel is shared between the host and the container.

Further, I'm worried. I could be wrong, but I have a feeling that the executable you are trying to run is malware. From my (admittedly quick) research, Hydra Bot is not distributed as an executable (neither Windows, nor Linux). It's a service provided through registration on their website, then inviting the bot to your Discord channel.

Again, I could be off base, but if I'm not -- Please confirm the source and be very cautious of attempting to run executables from untrusted sources.

L23P avatar
es flag
Off base! It's a bot for our fleet (like a guild/clan) we're named "Hydra" good spot! And thank you very much for the answer. I eventually decided to ditch the .exe assuming the issue is what you've confirmed. I got the bot running by de-compiling the .exe and just using the raw .json and .py etc needed for a normal discord bot. Someone in our fleet sent the .exe thinking it would be easier to just run it rather than mess around with additional files. The reason we went for an Ubuntu instance was his NAS was running it and that's how he was hosting it before I went to AWS for hosting.
NotTheDr01ds avatar
vn flag
@L23P Excellent - Glad to hear you got it working, and you definitely did it the right way. The `.exe` (compiled Python package) makes perfect sense now -- Thanks for the explanation!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.