Skip to content

GPU in Docker container becomes unavailable if not used for sometime #4038

Answered by matifali
matifali asked this question in Q&A
Discussion options

You must be logged in to vote

removing runtime and using gpus in docker_container fixed it for me.

resource "docker_container" "workspace" {
  count = data.coder_workspace.me.start_count
  image = docker_image.aihwkit.image_id
  cpu_shares = var.cpu
  memory = "${var.ram*1024}"
  gpus = "all"
  # Uses lower() to avoid Docker restriction on container names.
  name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
  # Hostname makes the shell more user friendly: coder@my-workspace:~$
  hostname = lower(data.coder_workspace.me.name)
  dns      = ["1.1.1.1"]
  # Use the docker gateway if the access URL is 127.0.0.1
  command = ["sh", "-c", replace(coder_agent.dev.init_script, "127.0.0.1", "h…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@matifali
Comment options

matifali Sep 13, 2022
Collaborator Author

Comment options

matifali
Oct 3, 2022
Collaborator Author

You must be logged in to vote
4 replies
@matifali
Comment options

matifali Oct 3, 2022
Collaborator Author

@mafredri
Comment options

@matifali
Comment options

matifali Oct 4, 2022
Collaborator Author

@matifali
Comment options

matifali Jun 7, 2024
Collaborator Author

Answer selected by matifali
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4037 on September 13, 2022 10:30.