Guide · 6 mins

How do I run a container?

corail run starts one container and exits.

$ corail run -d \
  --name web \
  -p 8080:80 \
  nginx:1.27
  • -d leaves the container running. The command returns.
  • --name web is the id for ps, logs, stop, and rm.
  • -p 8080:80 publishes port 80 in the container on port 8080 of the host. -p needs root, with --net bridge.
  • nginx:1.27 is the image. corail pulls it when it is not cached.

Rootless, drop -p. The default network is the host's, so a port the process binds is a port on the host.

$ corail run -d --name web nginx:1.27
$ corail ps
$ corail logs web
$ corail stop web
$ corail rm web

stop sends the stop signal. The container stays in ps as exited until rm. A recorded session is on Run a container. Every flag is on Commands.