The command lxc launch create container and run it.
How can I create the container and do not run it automatically?
You can use lxc init to create containers without starting them. It is not show by default, you can pass --all to show all available commands.
ishwar@xenial:~$ lxc --all
Usage: lxc [subcommand] [options]
Available commands:
config - Manage configuration.
copy - Copy containers within or in between lxd instances.
delete - Delete containers or container snapshots.
exec - Execute the specified command in a container.
file - Manage files on a container.
finger - Fingers the LXD instance to check if it is up and working.
help - Presents details on how to use LXD.
image - Manipulate container images.
info - List information on LXD servers and containers.
init - Initialize a container from a particular image.
launch - Launch a container from a particular image.
list - Lists the available resources.
monitor - Monitor activity on the LXD server.
move - Move containers within or in between lxd instances.
pause - Changes state of one or more containers to pause.
profile - Manage configuration profiles.
publish - Publish containers as images.
remote - Manage remote LXD servers.
restart - Changes state of one or more containers to restart.
restore - Set the current state of a resource back to a snapshot.
snapshot - Create a read-only snapshot of a container.
start - Changes state of one or more containers to start.
stop - Changes state of one or more containers to stop.
version - Prints the version number of this client tool.
Using lxc init you can create containers as follows.
lxc init ubuntu first
Use lxc init --help to get help on this command.
ishwar@xenial:~$ lxc init --help
Usage: Initialize a container from a particular image.
lxc init [remote:]<image> [remote:][<name>] [--ephemeral|-e] [--profile|-p <profile>...] [--config|-c <key=value>...]
Initializes a container using the specified image and name.
Not specifying -p will result in the default profile.
Specifying "-p" with no argument will result in no profile.
Example:
lxc init ubuntu u1
Options:
-c, --config (= map[])
Config key/value to apply to the new container
--debug (= false)
Enables debug mode.
-e, --ephemeral (= false)
Ephemeral container
--force-local (= false)
Force using the local unix socket.
--no-alias (= false)
Ignore aliases when determining what command to run.
-p, --profile (= [])
Profile to apply to the new container
--verbose (= false)
Enables verbose mode.
It works, thank you!
Most helpful comment
You can use lxc init to create containers without starting them. It is not show by default, you can pass --all to show all available commands.
Using lxc init you can create containers as follows.
Use lxc init --help to get help on this command.