I've got a host server which runs Jenkins. I'd like Jenkins to automatically create new containers and prepare those containers with SALT. The ultimate purpose is to use these containers to test code.
What is the best way to create a new container, install salt-minion, and then provision the server with salt?
I've tried something along the lines of lxc-attach -n myContainer -- salt-call --local state.highstate
but I'm running into problems doing that. If i run lxc-attach -n [name] -- [command] manually on the command line it works. However, doing this from a script gives me errors.
lxc-start -n "$1" -d
lxc-attach -n "$1" -- apt-get update
...results in...
Starting the container 'test2'...
Err http://archive.ubuntu.com trusty InRelease
Err http://archive.ubuntu.com trusty-updates InRelease
Err http://archive.ubuntu.com trusty Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://security.ubuntu.com trusty-security InRelease
Err http://security.ubuntu.com trusty-security Release.gpg
Could not resolve 'security.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
... and multiple more errors. I'm running both the script and the commands manually on the command line as the same user.
What could I be doing wrong here?
resolv.conf