Skip to content

Include docker compose example in docker docs#125

Open
matthewlouisbrockman wants to merge 7 commits intomainfrom
docker-compose
Open

Include docker compose example in docker docs#125
matthewlouisbrockman wants to merge 7 commits intomainfrom
docker-compose

Conversation

@matthewlouisbrockman
Copy link
Contributor

@matthewlouisbrockman matthewlouisbrockman commented Feb 20, 2026

Adds docker compose instructions to the docker page.

  • Creates separate trees for Docker and Docker Compose template/ build/run
  • Docker Compose Example code
  • Note on the "root" user required for now

@matthewlouisbrockman matthewlouisbrockman changed the title Docker Compose Example (Draft) Include docker compose example in docker docs Feb 20, 2026
Copy link
Contributor

@beran-t beran-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync on the ubuntu version in examples
Remove root as its not needed is user is in docker group

import { Template } from 'e2b'

export const composeTemplate = Template()
.fromUbuntuImage('24.04')
Copy link
Contributor

@beran-t beran-t Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using Ubuntu 24 and 25 interchangeably. We should probably stick to one. Not sure if 24 or 25?

"sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-compose-v2 || true",
"sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-compose || true",
"sudo docker compose version || sudo docker-compose --version",
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
]
'sudo usermod -aG docker username'
]

'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-compose-v2 || true',
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-compose || true',
'sudo docker compose version || sudo docker-compose --version',
])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
])
'sudo usermod -aG docker username'
])


const sbx = await Sandbox.create('docker-compose')

await sbx.commands.run('mkdir -p /tmp/docker-compose-test', { user: 'root' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await sbx.commands.run('mkdir -p /tmp/docker-compose-test', { user: 'root' })
await sbx.commands.run('mkdir -p /tmp/docker-compose-test')

echo "No compose command available"
exit 127
fi
`, { user: 'root' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`, { user: 'root' })
`)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o, is this fixed that we don't need root anymore? (or was there a way to get it to work alread?)


sbx = Sandbox.create("docker-compose")

sbx.commands.run("mkdir -p /tmp/docker-compose-test", user="root")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sbx.commands.run("mkdir -p /tmp/docker-compose-test", user="root")
sbx.commands.run("mkdir -p /tmp/docker-compose-test")

exit 127
fi
""",
user="root",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
user="root",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants