RE: Using docker for clean builds of classic snaps

2017-02-06 Thread VanCutsem, Geoffroy


> -Original Message-
> From: snapcraft-boun...@lists.snapcraft.io [mailto:snapcraft-
> boun...@lists.snapcraft.io] On Behalf Of Joseph Rushton Wakeling
> Sent: Sunday, February 5, 2017 11:52 PM
> To: snapcraft@lists.snapcraft.io
> Subject: Re: Using docker for clean builds of classic snaps
> 
> On 05/02/17 19:33, Loïc Minier wrote:
> > I dont think "snapd" is in the "ubuntu" Docker image which is trimmed
> > down a bit
> 
> Yes, I gathered that much, which is why my own Dockerfile attempt ensured
> that snapd would be installed with this line:
> 
>  RUN apt-get --assume-yes install snapd snapcraft
> 
> ... but as you say:
> 
> > it's also likely that snapd/snaps would hit some technical issues when
> > inside Docker. (This might be worth researching/debugging if you're
> > tempted.)
> 
> It looks to me like the snapd daemon doesn't actually run inside the
> container.
> If I try something simple like checking the version of snapd installed, then I
> get this output:
> 
> $ sudo docker run -v $PWD:$PWD -w $PWD 592f87a670d0 snap --version
> 2017/02/05 22:43:59.308309 main.go:220: WARNING: cannot create syslog
> logger
> snap2.21
> snapd   unavailable
> series  -
> 
> ... so it's clearly installed in my custom image, but not started.
> 
> If I _do_ try starting it as part of the command to run in the container, I 
> get
> the following:
> 
> $ sudo docker run -v $PWD:$PWD -w $PWD 592f87a670d0 systemctl enable -
> -now snapd.socket && snap install core && snapcraft clean && snapcraft
> error: access denied (try with sudo)
> 
> Trying `sudo` (as in `sudo systemctl enable ...`) doesn't seem to make any
> difference.
> 
> Any thoughts on what else I could try?  I'm happy to keep exploring myself
> but Docker and sockets aren't really my area of expertise.

I ran into something similar when trying to build a Docker image that would 
start services via systemd service files. It turned out that systemd does not 
run out-of-the-box in Docker containers (this was the best blog post I had 
found on the topic: 
https://rhatdan.wordpress.com/2014/04/30/running-systemd-within-a-docker-container/,
 and a seemingly working mechanism, for Ubuntu 15.xx here: 
https://github.com/dockerimages/docker-systemd).

I actually did not go down that path as I found it easier for me to simply 
start my daemons/services outside of systemd, from a simple script invoked by 
CMD in my Dockerfile. This may just work and be sufficient for you.

Geoffroy


> 
> I would imagine, though, that the kinds of issues I'm running into with
> Docker are fundamentally the same issues that make it hard for classic snaps
> to support `snapcraft cleanbuild` using lxd ... ?
> 
> Thanks & best wishes,
> 
>  -- Joe
> 
> --
> Snapcraft mailing list
> Snapcraft@lists.snapcraft.io
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/snapcraft

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Using docker for clean builds of classic snaps

2017-02-05 Thread Joseph Rushton Wakeling

On 05/02/17 19:33, Loïc Minier wrote:

I dont think "snapd" is in the "ubuntu" Docker image which is trimmed down a
bit


Yes, I gathered that much, which is why my own Dockerfile attempt ensured that 
snapd would be installed with this line:


RUN apt-get --assume-yes install snapd snapcraft

... but as you say:


it's also likely that snapd/snaps would hit some technical issues when
inside Docker. (This might be worth researching/debugging if you're tempted.)


It looks to me like the snapd daemon doesn't actually run inside the container. 
If I try something simple like checking the version of snapd installed, then I 
get this output:


$ sudo docker run -v $PWD:$PWD -w $PWD 592f87a670d0 snap --version
2017/02/05 22:43:59.308309 main.go:220: WARNING: cannot create syslog logger
snap2.21
snapd   unavailable
series  -

... so it's clearly installed in my custom image, but not started.

If I _do_ try starting it as part of the command to run in the container, I get 
the following:


$ sudo docker run -v $PWD:$PWD -w $PWD 592f87a670d0 systemctl enable --now 
snapd.socket && snap install core && snapcraft clean && snapcraft

error: access denied (try with sudo)

Trying `sudo` (as in `sudo systemctl enable ...`) doesn't seem to make any 
difference.


Any thoughts on what else I could try?  I'm happy to keep exploring myself but 
Docker and sockets aren't really my area of expertise.


I would imagine, though, that the kinds of issues I'm running into with Docker 
are fundamentally the same issues that make it hard for classic snaps to support 
`snapcraft cleanbuild` using lxd ... ?


Thanks & best wishes,

-- Joe

--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Using docker for clean builds of classic snaps

2017-02-05 Thread Loïc Minier
Hi Joseph,

On Sun, Feb 5, 2017 at 3:13 PM, Joseph Rushton Wakeling <
joseph.wakel...@webdrake.net> wrote:

> $ sudo docker run -v $PWD:$PWD -w $PWD [my-image-id] snap install core &&
> snapcraft clean && snapcraft
> 2017/02/05 14:07:35.998824 main.go:220: WARNING: cannot create syslog
> logger
> error: cannot communicate with server: Post http://localhost/v2/snaps/core:
> dial unix /run/snapd-snap.socket: connect: no such file or directory
>

I dont think "snapd" is in the "ubuntu" Docker image which is trimmed down
a bit; it's also likely that snapd/snaps would hit some technical issues
when inside Docker. (This might be worth researching/debugging if you're
tempted.)

Cheers,
- Loïc
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Using docker for clean builds of classic snaps

2017-02-05 Thread Joseph Rushton Wakeling

On 02/02/17 22:35, Loïc Minier wrote:

There are a bunch of Docker images providing snapcraft
,
unfortunately they are all behind. These should be autobuilt instead of manually
updated, in the mean time I suggest you build your own (relatively easy)
. Otherwise,
Didier's image  is only a
month old and should include a snapcraft with experimental support for classic
snaps.


Thanks Loïc :-)

Images like the ones you point to match pretty much what I came up with myself, 
but I ran into difficulties installing the core snap (required for building 
classic snaps).


My Dockerfile was as follows:

##

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get --assume-yes dist-upgrade
RUN apt-get --assume-yes install snapd snapcraft
RUN snap install core

##

... and when building the image, it would fall over at the last step:

Step 5/5 : RUN snap install core
 ---> Running in fb52514fbd30
2017/02/05 13:59:56.811387 main.go:220: WARNING: cannot create syslog logger
error: cannot communicate with server: Post http://localhost/v2/snaps/core: dial 
unix /run/snapd-snap.socket: connect: no such file or directory


I would get a similar error if I tried deleting the last line of the Dockerfile 
but running `snap install core` manually in the container:


$ sudo docker run -v $PWD:$PWD -w $PWD [my-image-id] snap install core && 
snapcraft clean && snapcraft

2017/02/05 14:07:35.998824 main.go:220: WARNING: cannot create syslog logger
error: cannot communicate with server: Post http://localhost/v2/snaps/core: dial 
unix /run/snapd-snap.socket: connect: no such file or directory


I presume I'm missing something here in terms of setting up sockets for the 
image/container?


Thanks & best wishes,

-- Joe

--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Using docker for clean builds of classic snaps

2017-02-02 Thread Loïc Minier
There are a bunch of Docker images providing snapcraft
,
unfortunately they are all behind. These should be autobuilt instead of
manually updated, in the mean time I suggest you build your own (relatively
easy) .
Otherwise, Didier's image
 is only a month old
and should include a snapcraft with experimental support for classic snaps.

Cheers,
- Loïc

On Thu, Feb 2, 2017 at 9:18 PM, Joseph Rushton Wakeling <
joseph.wakel...@webdrake.net> wrote:

> On 02/02/17 14:40, Jamie Bennett wrote:
>
>> We have this page that explains how to build using Docker containers (the
>> url name is wrong but the contents are right).
>>
>>   * https://snapcraft.io/docs/build-snaps/trusty
>>
>
> Hi Jamie -- thanks for the pointer.  Unfortunately it doesn't work with
> classic snaps :-(
>
> $ sudo docker run -v $PWD:$PWD -w $PWD snapcore/snapcraft snapcraft
> Unable to find image 'snapcore/snapcraft:latest' locally
> latest: Pulling from snapcore/snapcraft
> 2f0243478e1f: Pull complete
> d8909ae88469: Pull complete
> 820f09abed29: Pull complete
> 01193a8f3d88: Pull complete
> 22802091ea0e: Pull complete
> Digest: sha256:a1c3ddcfd7d8af5a9ad5762f3d014389ef6db718a848ce59c5add
> 791b65036a4
> Status: Downloaded newer image for snapcore/snapcraft:latest
> Issues while validating snapcraft.yaml: The 'confinement' property does
> not match the required schema: 'classic' is not one of ['devmode', 'strict']
>
>
>
>
> --
> Snapcraft mailing list
> Snapcraft@lists.snapcraft.io
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
> an/listinfo/snapcraft
>



-- 
- Loïc
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Using docker for clean builds of classic snaps

2017-02-02 Thread Joseph Rushton Wakeling

On 02/02/17 14:40, Jamie Bennett wrote:

We have this page that explains how to build using Docker containers (the url 
name is wrong but the contents are right).

  * https://snapcraft.io/docs/build-snaps/trusty


Hi Jamie -- thanks for the pointer.  Unfortunately it doesn't work with classic 
snaps :-(


$ sudo docker run -v $PWD:$PWD -w $PWD snapcore/snapcraft snapcraft
Unable to find image 'snapcore/snapcraft:latest' locally
latest: Pulling from snapcore/snapcraft
2f0243478e1f: Pull complete
d8909ae88469: Pull complete
820f09abed29: Pull complete
01193a8f3d88: Pull complete
22802091ea0e: Pull complete
Digest: sha256:a1c3ddcfd7d8af5a9ad5762f3d014389ef6db718a848ce59c5add791b65036a4
Status: Downloaded newer image for snapcore/snapcraft:latest
Issues while validating snapcraft.yaml: The 'confinement' property does not 
match the required schema: 'classic' is not one of ['devmode', 'strict']




--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Using docker for clean builds of classic snaps

2017-02-02 Thread Jamie Bennett
Hi Joe,

We have this page that explains how to build using Docker containers (the url 
name is wrong but the contents are right).

  * https://snapcraft.io/docs/build-snaps/trusty

Regards,
Jamie.

> On 1 Feb 2017, at 22:47, Joseph Rushton Wakeling 
>  wrote:
> 
> Hello all,
> 
> Curious question.  Since snapcraft cleanbuild support is still a 
> work-in-progress for classic snaps, has anyone tried using Docker to provide 
> a clean build environment for them?  If so -- can you advise on what you did?
> 
> I'm not super Docker-experienced, so while I imagine setting up the basic 
> environment wouldn't be too difficult -- I don't imagine the dockerfile would 
> need much more than FROM ubuntu:16.04 and the installation of snapcraft -- 
> I'm not sure how to run the actual snapcraft command via Docker.  Can anyone 
> suggest how to do this?
> 
> No worries if no one can advise -- if not, assuming cleanbuild support isn't 
> close in the pipeline, I will try to look into this further myself in the 
> next weeks.
> 
> Thanks & best wishes,
> 
>-- Joe
> 
> -- 
> Snapcraft mailing list
> Snapcraft@lists.snapcraft.io
> Modify settings or unsubscribe at: 
> https://lists.ubuntu.com/mailman/listinfo/snapcraft


-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Using docker for clean builds of classic snaps

2017-02-01 Thread Luther Goh Lu Feng
I am new to Docker too but these few steps got me going

If you are running on armhf, you may try using this 
https://hub.docker.com/r/elfgoh/armhf-ubuntu-snapcraft/

$ docker run -it -v $(pwd):/usr/me/ spdigital/armhf-ubuntu-snapcraft /bin/bash


# Above gets you a shell in your docker container, from which you can run $ 
snapcraft 

$ docker ps -a #find container id

$ docker rm 

-- Luther



On Thursday, February 2, 2017 6:48 AM, Joseph Rushton Wakeling 
 wrote:
Hello all,

Curious question.  Since snapcraft cleanbuild support is still a 
work-in-progress for classic snaps, has anyone tried using Docker to provide a 
clean build environment for them?  If so -- can you advise on what you did?

I'm not super Docker-experienced, so while I imagine setting up the basic 
environment wouldn't be too difficult -- I don't imagine the dockerfile would 
need much more than FROM ubuntu:16.04 and the installation of snapcraft -- I'm 
not sure how to run the actual snapcraft command via Docker.  Can anyone 
suggest 
how to do this?

No worries if no one can advise -- if not, assuming cleanbuild support isn't 
close in the pipeline, I will try to look into this further myself in the next 
weeks.

Thanks & best wishes,

 -- Joe

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft