@@ -4666,95 +4666,3 @@ func (s *delayedReader) Read([]byte) (int, error) {
46664666 time .Sleep (500 * time .Millisecond )
46674667 return 0 , io .EOF
46684668}
4669-
4670- // #28823 (originally #28639)
4671- func (s * DockerSuite ) TestRunMountReadOnlyDevShm (c * check.C ) {
4672- testRequires (c , SameHostDaemon , DaemonIsLinux )
4673- emptyDir , err := ioutil .TempDir ("" , "test-read-only-dev-shm" )
4674- c .Assert (err , check .IsNil )
4675- defer os .RemoveAll (emptyDir )
4676- out , _ , err := dockerCmdWithError ("run" , "--rm" , "--read-only" ,
4677- "-v" , fmt .Sprintf ("%s:/dev/shm:ro" , emptyDir ),
4678- "busybox" , "touch" , "/dev/shm/foo" )
4679- c .Assert (err , checker .NotNil , check .Commentf (out ))
4680- c .Assert (out , checker .Contains , "Read-only file system" )
4681- }
4682-
4683- // Test case for 29129
4684- func (s * DockerSuite ) TestRunHostnameInHostMode (c * check.C ) {
4685- testRequires (c , DaemonIsLinux )
4686-
4687- expectedOutput := "foobar\n foobar"
4688- out , _ := dockerCmd (c , "run" , "--net=host" , "--hostname=foobar" , "busybox" , "sh" , "-c" , `echo $HOSTNAME && hostname` )
4689- c .Assert (strings .TrimSpace (out ), checker .Equals , expectedOutput )
4690- }
4691-
4692- func (s * DockerRegistrySuite ) TestRunWithAdditionalRegistry (c * check.C ) {
4693- if err := s .d .StartWithBusybox ("--add-registry=" + s .reg .url ); err != nil {
4694- c .Fatalf ("we should have been able to start the daemon with passing add-registry=%s: %v" , s .reg .url , err )
4695- }
4696-
4697- bbImg := s .d .getAndTestImageEntry (c , 1 , "busybox" , "" )
4698-
4699- // push busybox to additional registry as "library/hello-world" and remove all local images
4700- if out , err := s .d .Cmd ("tag" , "busybox" , s .reg .url + "/busybox" ); err != nil {
4701- c .Fatalf ("failed to tag image busybox: error %v, output %q" , err , out )
4702- }
4703- if out , err := s .d .Cmd ("rmi" , "busybox" ); err != nil {
4704- c .Fatalf ("failed to remove image busybox: %v, output: %s" , err , out )
4705- }
4706- s .d .getAndTestImageEntry (c , 1 , s .reg .url + "/busybox" , bbImg .id )
4707-
4708- // try to run fully qualified image
4709- if out , err := s .d .Cmd ("run" , "-t" , s .reg .url + "/busybox" , "sh" , "-c" , "echo foo" ); err != nil {
4710- c .Fatalf ("failed to run %s/busybox image: %v, output: %s" , s .reg .url , err , out )
4711- } else if strings .TrimSpace (out ) != "foo" {
4712- c .Fatalf ("got unexpected output: %q" , out )
4713- }
4714-
4715- // try to run unqualified
4716- if out , err := s .d .Cmd ("run" , "-t" , "busybox" , "sh" , "-c" , "echo foo" ); err != nil {
4717- c .Fatalf ("failed to run busybox image: %v, output: %s" , err , out )
4718- } else if out != "foo\r \n " {
4719- c .Fatalf ("got unexpected output: %q" , out )
4720- }
4721-
4722- // try to run hello world from additional registry
4723- if out , err := s .d .Cmd ("run" , "-t" , s .reg .url + "/library/hello-world" , "sh" , "-c" , "echo foo" ); err == nil {
4724- c .Fatalf ("running container from image %s/library/hello-world should have failed; output: %s" , s .reg .url , out )
4725- }
4726-
4727- // try to run hello-world from official registry
4728- if out , err := s .d .Cmd ("run" , "-t" , "library/hello-world" ); err != nil {
4729- c .Fatalf ("failed to run library/hello-world image: %v, output: %s" , err , out )
4730- } else if strings .HasSuffix (strings .TrimSpace (out ), "foo" ) {
4731- c .Fatalf ("got unexpected output" )
4732- }
4733- s .d .getAndTestImageEntry (c , 2 , "docker.io/hello-world" , "" )
4734-
4735- // push busybox to additional registry as "library/hello-world" and remove all local images
4736- if out , err := s .d .Cmd ("tag" , s .reg .url + "/busybox" , s .reg .url + "/library/hello-world" ); err != nil {
4737- c .Fatalf ("failed to tag image %s: error %v, output %q" , s .reg .url + "/busybox" , err , out )
4738- }
4739- if out , err := s .d .Cmd ("push" , s .reg .url + "/library/hello-world" ); err != nil {
4740- c .Fatalf ("failed to push image %s: error %v, output %q" , s .reg .url + "/library/hello-world" , err , out )
4741- }
4742- args := []string {"rmi" , "-f" , "hello-world" , "library/hello-world" , "busybox" }
4743- if out , err := s .d .Cmd (args ... ); err != nil {
4744- c .Fatalf ("failed to remove images %v: %v, output: %s" , args [1 :], err , out )
4745- }
4746- s .d .getAndTestImageEntry (c , 0 , "" , "" )
4747-
4748- // now try to run unqualified hello-world again - this time we should pull from additional registry
4749- if out , err := s .d .Cmd ("run" , "-t" , "library/hello-world" , "sh" , "-c" , "echo foo" ); err != nil {
4750- c .Fatalf ("failed to run library/hello-world image: %v, output: %s" , err , out )
4751- } else if ! strings .HasSuffix (strings .TrimSpace (out ), "\n foo" ) {
4752- c .Fatalf ("got unexpected output: %q" , out )
4753- }
4754- // image id now differs from busybox because ids are generated again upon full pull
4755- hwImg := s .d .getAndTestImageEntry (c , 1 , s .reg .url + "/library/hello-world" , "" )
4756- // therefore we need to compare size
4757- if bbImg .size != hwImg .size {
4758- c .Fatalf ("expected %s:%s and %s:%s to have equal size (%s != %s)" , hwImg .name , hwImg .tag , bbImg .name , bbImg .tag , hwImg .size , bbImg .size )
4759- }
4760- }
0 commit comments