Bug 1440389 - Can not create services with secrets in swarm mode
Summary: Can not create services with secrets in swarm mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: docker
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Antonio Murdaca
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1511230
TreeView+ depends on / blocked
 
Reported: 2017-04-08 12:48 UTC by Spyros Trigazis
Modified: 2017-11-08 23:29 UTC (History)
14 users (show)

Fixed In Version: docker-1.13.1-7.git14cc629.fc26 docker-1.13.1-13.git51eb16e.fc26
Clone Of:
: 1511230 1590237 (view as bug list)
Environment:
Last Closed: 2017-06-09 19:14:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Spyros Trigazis 2017-04-08 12:48:41 UTC
Description of problem:
In a swarm mode cluster using docker 1.13 in fedora atomic 26,
it's impossible to create a service with a secret mounted in
its containers. The service is created but the containers are
crashing. 

Version-Release number of selected component (if applicable):
docker-1.13.1-5.git5be1549.fc26.x86_64

How reproducible: 100%


Steps to Reproduce:
1. Boot a F26AH with [1]
2. Login to the host and switch to the root user
3.
# docker swarm init
Swarm initialized: current node (yxoss27y1h5d87mrtgfij4q3d) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join \
    --token SWMTKN-1-0sg2bj4onjvyaygcmcsftvx5z48f2r0oq6abg4izaflch9d8r8-dva3kq1zw7vrzjg8sav3e5mcs \
    xxx.xxx.xxx.xxx:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
4.
# docker service ls
ID  NAME  MODE  REPLICAS  IMAGE
5.
#  echo "This is a secret" | docker secret create my_secret_data -
2ab8kotd9e9q9wcpe387tryez
6.
# docker service create --name="httpd" --secret="my_secret_data" docker.io/httpd
ri4wtno7wu93yfczzb93l6s8s


Actual results:
# docker service ps httpd --no-trunc
ID                         NAME         IMAGE                                                                                           NODE                                 DESIRED STATE  CURRENT STATE         ERROR                                                                                                                                                                                                    PORTS
p6jrn0kybq8vjx69avb3xdcxc  httpd.1      docker.io/httpd:latest@sha256:fc9b21c3faf2e1aa4cbe91d60df40a0d30ff151d8a5f5228d77fe5e0a18fa3c2  strigazi-fa26-swarm-mode-04.cern.ch  Ready          Ready 2 seconds ago                                                                                                                                                                                                            
yx2mquqmna77u8uxo7exgxc6m   \_ httpd.1  docker.io/httpd:latest@sha256:fc9b21c3faf2e1aa4cbe91d60df40a0d30ff151d8a5f5228d77fe5e0a18fa3c2  strigazi-fa26-swarm-mode-04.cern.ch  Shutdown       Failed 2 seconds ago  "starting container failed: RemoveSecretsPath failed: remove /var/lib/docker/containers/115332b56220016b062dcdd69f128775736f86605219d3081af848d5b4ca6a15/secrets/my_secret_data: read-only file system"  

Expected results:
The service running, something like:
# docker service ps redis

ID            NAME     IMAGE         NODE              DESIRED STATE  CURRENT STATE          ERROR  PORTS
bkna6bpn8r1a  redis.1  redis:alpine  ip-172-31-46-109  Running        Running 8 seconds ago  

Additional info:
Follow [2] using a F26AH like [1].

[1] https://s3.amazonaws.com/fedora-atomic-s3/Fedora-26-20170331.n.0/Fedora-Atomic-26-20170331.n.0.x86_64.qcow2
[2] https://docs.docker.com/engine/swarm/secrets/#simple-example-get-started-with-secrets

Comment 4 Antonio Murdaca 2017-04-11 10:54:58 UTC
rewrote the secret patch to allow this workflow (patch set is at https://github.com/runcom/docker/tree/secrets-rewrite)

Not sure how we're going with this. The commits I did aren't in the main "docker-1.13.1 tree" as I think we need full docker testing (autotest also) to run with my branches before merging my patches.

By any change, can you build docker from https://github.com/runcom/docker/tree/secrets-rewrite and test this out? it's working to my testing.

Comment 5 Antonio Murdaca 2017-04-11 11:01:52 UTC
PR opened https://github.com/projectatomic/docker/pull/235

Comment 6 Spyros Trigazis 2017-04-11 15:07:04 UTC
I used this [1] image, upgraded to 26 and installed these packages:
docker-1.13.1-9.gitdcc0a71.fc27.x86_64.rpm
docker-common-1.13.1-9.gitdcc0a71.fc27.x86_64.rpm
docker-rhel-push-plugin-1.13.1-9.gitdcc0a71.fc27.x86_64.rpm


Now the container is running:
# docker service ps redis
ID            NAME     IMAGE                   NODE                                               DESIRED STATE  CURRENT STATE          ERROR  PORTS
whvth13frrhv  redis.1  docker.io/redis:alpine  strigazi-fedora-cloud-base-25-20170411-01.cern.ch  Running        Running 2 minutes ago         


BUT I can't access the secret:
# echo "This is a secret" | docker secret create my_secret_data -
jq9szkiqdg1kh3rip836mry36
# docker service  create --name="redis" --secret="my_secret_data" docker.io/redis:alpine
vfhequwmelqg1ljzueh109jcx
# docker exec $(docker ps --filter name=redis -q) ls -l /run/secrets
total 0
ls: can't open '/run/secrets': Permission denied

[1] https://kojipkgs.fedoraproject.org/compose/Fedora-Cloud-25-20170411.0/compose/CloudImages/x86_64/images/Fedora-Cloud-Base-25-20170411.0.x86_64.qcow2

Comment 7 Antonio Murdaca 2017-04-11 15:14:10 UTC
That's caused by SELinux, I'm trying to fix the patch

Comment 8 Spyros Trigazis 2017-04-11 15:31:48 UTC
Confirmed, with selinux in permissive, it works.

Comment 9 Antonio Murdaca 2017-04-11 15:41:19 UTC
alright, fixed the selinux issue in the latest iteration of https://github.com/runcom/docker/commits/secrets-rewrite

I'll have a scratch build for you to test!

Comment 10 Lokesh Mandvekar 2017-04-11 20:08:22 UTC
Scratch build at https://koji.fedoraproject.org/koji/taskinfo?taskID=18935284

Comment 11 Spyros Trigazis 2017-04-12 07:51:51 UTC
working, thanks

Comment 12 Spyros Trigazis 2017-04-12 07:59:57 UTC
Are we getting this fix in F26 ?

Comment 13 Antonio Murdaca 2017-04-12 10:18:34 UTC
(In reply to Spyros Trigazis from comment #12)
> Are we getting this fix in F26 ?

yeah, possibly.

Comment 15 Antonio Murdaca 2017-04-13 11:35:34 UTC
Any chance you can re-test with new rpms?

Comment 16 Dusty Mabe 2017-04-13 14:06:49 UTC
you can pull down this qcow which has the new docker installed. 
http://artifacts.ci.centos.org/sig-atomic/expires-7-days/20170413-scratch-docker/0bef1375-6bb2-47f6-807b-cfba18eacbaa.body.qcow2

Comment 17 Daniel Walsh 2017-04-13 18:49:29 UTC
Antonio, so this was just swarm created the directory with a bad label?

Comment 18 Spyros Trigazis 2017-04-14 14:20:30 UTC
(In reply to Antonio Murdaca from comment #15)
> Any chance you can re-test with new rpms?

Tested both builds They work fine, thanks!

docker swarm init
echo "This is a secret" | docker secret create my_secret_data -
docker service  create --name="httpd" --secret="my_secret_data" docker.io/httpd
# wait for service to start
docker exec $(docker ps --filter name=httpd -q) cat /run/secrets/my_secret_data

(In reply to Dusty Mabe from comment #16)
> you can pull down this qcow which has the new docker installed. 
> http://artifacts.ci.centos.org/sig-atomic/expires-7-days/20170413-scratch-
> docker/0bef1375-6bb2-47f6-807b-cfba18eacbaa.body.qcow2

Downloading. It is really slow.

Comment 19 Spyros Trigazis 2017-04-14 15:20:54 UTC
(In reply to Dusty Mabe from comment #16)
> you can pull down this qcow which has the new docker installed. 
> http://artifacts.ci.centos.org/sig-atomic/expires-7-days/20170413-scratch-
> docker/0bef1375-6bb2-47f6-807b-cfba18eacbaa.body.qcow2

Works great! Thanks! SELinux enforcing :)

Comment 20 Fedora Update System 2017-04-17 14:44:24 UTC
docker-1.13.1-7.git14cc629.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-e66179a210

Comment 21 Fedora Update System 2017-04-17 23:50:55 UTC
docker-1.13.1-7.git14cc629.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-e66179a210

Comment 22 Fedora Update System 2017-04-21 14:28:05 UTC
docker-1.13.1-7.git14cc629.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 23 Antonio Murdaca 2017-04-21 14:31:24 UTC
PR still pending! https://github.com/projectatomic/docker/pull/235

Comment 24 Dusty Mabe 2017-05-26 14:30:41 UTC
did this make it into a build? can we attach it to a proper bodhi update?

Comment 25 Fedora Update System 2017-05-28 15:44:32 UTC
docker-1.13.1-13.git51eb16e.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-8a6d53a5d6

Comment 26 Fedora Update System 2017-05-28 15:47:22 UTC
docker-latest-1.13-30.git51eb16e.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-e8d134ef02

Comment 27 Fedora Update System 2017-05-28 21:37:36 UTC
docker-1.13.1-13.git51eb16e.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-8a6d53a5d6

Comment 28 Fedora Update System 2017-05-28 21:37:43 UTC
docker-latest-1.13-30.git51eb16e.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-e8d134ef02

Comment 29 Fedora Update System 2017-06-09 19:14:02 UTC
docker-1.13.1-13.git51eb16e.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 30 Fedora Update System 2017-06-09 19:14:10 UTC
docker-latest-1.13-30.git51eb16e.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 31 Dusty Mabe 2017-06-12 18:22:36 UTC
hey strigazi can you test this in latest F26AH and make sure it is fixed for you? 

https://kojipkgs.fedoraproject.org/compose/branched/Fedora-26-20170611.n.1/compose/CloudImages/x86_64/images/

Comment 32 Spyros Trigazis 2017-06-16 07:40:47 UTC
Tested, works fine!

Thanks!


Note You need to log in before you can comment on or make changes to this bug.