So far we have created a project that allowed containers of the same name to be created in different projects.
However both the default
and client-website
projects shared the same profiles and image libraries.
This means that the the default
profile in client-website
project is the same as the default
profile in the default
project.
But there are scenarios where we may want to further isolate a project such that profile and image names are not shared beyond it.
Lets imagine we have now taken on a new client and we need to create a new project for them. However this client requires a different network configuration than the previous client required.
We could create a new global profile called client2-default
with the required networking configuration and then assign that profile to the containers in this new project.
However this would mean that the client2-default
profile would be accessible to all containers that shared the default
project (including our previously created client-website
project). This would be confusing.
Instead, lets create a new project called client2-website
, but this time specify that it should not share the default
project’s profiles and image library.
lxc project create client2-website -c features.images=true -c features.profiles=true
This is equivalent to running just:
lxc project create client2-website
Now lets create a container in the new project:
lxc launch ubuntu:18.04 webserver --project client2-website
Note: We are using the --project
flag on the lxc launch
command to save switching into the new project.
Oops! Something went wrong though, you will get this output:
Creating webserver
Error: Failed container creation: Create container: Create LXC container: Invalid devices: Detect root disk device: No root device could be found
Continue to the next step to find out what is going wrong!