3

When I run docker locally "docker run -it -p 8080:8080 codercom/code-server --auth none" I am using --auth none argument, but how can i use this in azure container create commands.

If I run normally like "az container create --resource-group learn-deploy-vsCode --name code-server --image codercom/code-server --auth none --ports 8080 --dns-name-label san-codeserver --location eastus" it is throwing error "az: error: unrecognized arguments: --auth none".

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
San
  • 69
  • 1
  • 8
  • Can you share the Dockerfile of this image? – Charles Xu Apr 08 '20 at 06:10
  • this is from docker hub https://hub.docker.com/r/codercom/code-server I dint find any Docker file – San Apr 08 '20 at 06:21
  • this can be useful https://hub.docker.com/layers/codercom/code-server/latest/images/sha256-ff785c1c004bee0574807e540e205d2d4293a96efb3c521d69f07c99461263d4?context=explore – San Apr 08 '20 at 06:27

1 Answers1

3

When you run the command docker run -it -p 8080:8080 codercom/code-server --auth none locally, it means you add the parameter --auth none for the command in the link you provide. But when you run the CLI command with the parameter --auth none, the Azure CLI will look it as the parameter of the CLI command az container create, and this parameter does not support in the CLI.

So what you need to do is change the CLI command like this:

az container create --resource-group learn-deploy-vsCode \
--name code-server \
--image codercom/code-server \
--command-line "/usr/local/bin/code-server --host 0.0.0.0 . --auth none" \
--ports 8080 \
--dns-name-label san-codeserver   \
--location eastus
Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • how did you get this --command-line "/usr/local/bin/code-server --host 0.0.0.0 . --auth none" \ ? Is this run in bash of code-server? can you explain in detail? – San Apr 08 '20 at 06:49
  • @San The parameter `--command-line` will overwrite the command in the Dockerfile. So you need to run the command manually. – Charles Xu Apr 08 '20 at 06:51
  • why you added "--host 0.0.0.0 ."? – San Apr 08 '20 at 07:47
  • @San It's not me, it's the command in the Dockerfile. But I can tell you that it means the application listens to the address 0.0.0.0 and it can receive all the requests to this machine. – Charles Xu Apr 08 '20 at 07:49
  • where did you get docker file for it? – San Apr 08 '20 at 09:15
  • can you help here https://stackoverflow.com/questions/61386014/problem-in-running-code-server-in-https-secure – San Apr 23 '20 at 11:22
  • @San Yeah, I will take a try. – Charles Xu Apr 24 '20 at 01:23